COM SCI 31 Lecture Notes - Lecture 14: C String Handling
Document Summary
String name[5] = { fred , ethel , lucy , ricky , little ricky }; Int tally (char a[][max_name_len+1], int n, int targetlength); Int main () const int maxpets = 5; Char pets[maxpets][max_name_len +1] = { //account for zero byte. Get values for r and angle double x; double y; polartocartesian(r, angle, &x, &y); void polartocartesion(double rho, double theta, double* xx, double* yy) *xx = rho * cos(theta); //xx can"t hold double; only holds pointer. As the name of a type: double double. *p the object that p points to follow the pointer every pointer has certain type double a = 3. 2; double b = 5. 1; double* p = &a. Double c = a; double* q = 7. 6 //error! Double& dd = d; //dd is a reference, not a pointer. *p = b; //assigning one double to another double p = *b //assigning one pointer to another p += 4; //*p = *p +4; int k; p = &k //error!