Pages

July 25, 2010

Review OOP244 - Primitive types & Derived Types

Both C and C++ predefine all of their primitive types. We cannot redefine these types or introduce new primitive types.
int,double,float,char

derived types
struct Type{
...
};

 struct Student {
int no; // student number
char grade[14]; // grades
};


struct Student harry;


to access harry's student number, we write

harry.no;


to get address of harry's student number, we write

&harry.no;
//&harry.grade[0];

We retrieve the address of a non-array member using the address of operator (&)


&instance.member

No comments:

Post a Comment