COM SCI 31 Lecture Notes - Lecture 14: C String Handling

19 views2 pages
14 Aug 2017
School

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!

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers