Lecture notes_2/28_Kailu Song

1. reminder 2/26

for structure using #ifndef VECTOR_H & #define VECTOR_H together

2. pointer inside a structure vector vector_construct2() {

 vector v;
 v.x = a;
 v.y = b;
 v.z = c;

} return v; void vector_destruct(vector*v) {free (v);} void vector_double(vector *v) {

 v->x *=2;
 v->y *=2;
 v->z *=2;

} void vector_double2(Vector v) {

 v.x *=2;
 v.y *=2;
 v.z *=2;

}

be aware of constructor and destructor should be symmetric malloc first and free last 3. topics we have before exam 1 Makefile,recursion,search,file(text and binary) malloc/free structure (with pointers) pointers stack/heap memory functions 2-d arrays strings 4. different between one-d and 2-d array arr2d[numRow][numCol] [0][0] [0][1] [0][2] [1][0] [1][1] [1][2] [2][0] [2][1] [2][2] one-d [0] [1] [2] [3] [4] [5] [6] [7] [8]

Alumni Liaison

Correspondence Chess Grandmaster and Purdue Alumni

Prof. Dan Fleetwood