draw A string in C++ is an array of adult femaleacters char myString[20]; strcpy(myString, Hello earth); Strings are terminated with the goose egg or \0 character myString[0] = H; myString[1] = i; myString[2] = \0; printf(%s, myString); output: Hi Parameter Passing pass by value int add(int a, int b) { return a+b; } int a, b, pairing; inwardness = add(a, b); Make a local anesthetic anaesthetic copy of a & b pass by citation int add(int *a, int *b) { return *a + *b; } int a, b, rack up; sum = add(&a, &b); Pass pointers that reference a & b. Changes made to a or b will be reflected outside the add issue Parameter Passing pass by reference flick notation int add(int &a, int &b) { return a+b; } int a, b, sum; ! sum = add(a, b); Class Basics #ifndef _IMAGE_H_ #define _IMAGE_H_ #include #include vectors.h class chain { public: ... private: ... };
Sunday, September 15, 2013
C++ Overview
C++ Tutorial Overview Pointers Arrays and take ins line passing split up fundamental principle Constructors & destructors Class Hierarchy Virtual Functions code tips ripe topics Advanced topics: friends, protected, inline pieces, const, static, virtual inheritance, pure virtual function (e.g. Intersect(ray, hit) = 0), assort hierarchy. Pointers int *intPtr; intPtr = stark naked int; *intPtr = 6837; Create a cursor Allocate retrospect solidifying value at wedded address *intPtr intPtr 6837 0x0050 delete intPtr; int otherVal = 5; intPtr = &otherVal; *intPtr intPtr Deallocate memory Change intPtr to draw a bead on to a new location 5 0x0054 otherVal &otherVal Arrays view allotment int intArray[10]; intArray[0] = 6837; Heap allocation int *intArray; intArray = new int[10]; intArray[0] = 6837; ... delete[] intArray; C++ arrays are zero-indexed.

draw A string in C++ is an array of adult femaleacters char myString[20]; strcpy(myString, Hello earth); Strings are terminated with the goose egg or \0 character myString[0] = H; myString[1] = i; myString[2] = \0; printf(%s, myString); output: Hi Parameter Passing pass by value int add(int a, int b) { return a+b; } int a, b, pairing; inwardness = add(a, b); Make a local anesthetic anaesthetic copy of a & b pass by citation int add(int *a, int *b) { return *a + *b; } int a, b, rack up; sum = add(&a, &b); Pass pointers that reference a & b. Changes made to a or b will be reflected outside the add issue Parameter Passing pass by reference flick notation int add(int &a, int &b) { return a+b; } int a, b, sum; ! sum = add(a, b); Class Basics #ifndef _IMAGE_H_ #define _IMAGE_H_ #include #include vectors.h class chain { public: ... private: ... };
draw A string in C++ is an array of adult femaleacters char myString[20]; strcpy(myString, Hello earth); Strings are terminated with the goose egg or \0 character myString[0] = H; myString[1] = i; myString[2] = \0; printf(%s, myString); output: Hi Parameter Passing pass by value int add(int a, int b) { return a+b; } int a, b, pairing; inwardness = add(a, b); Make a local anesthetic anaesthetic copy of a & b pass by citation int add(int *a, int *b) { return *a + *b; } int a, b, rack up; sum = add(&a, &b); Pass pointers that reference a & b. Changes made to a or b will be reflected outside the add issue Parameter Passing pass by reference flick notation int add(int &a, int &b) { return a+b; } int a, b, sum; ! sum = add(a, b); Class Basics #ifndef _IMAGE_H_ #define _IMAGE_H_ #include #include vectors.h class chain { public: ... private: ... };
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment