Computer Programming and Analysis IPC144 Lecture Notes - Function Prototype

353 views4 pages

Document Summary

Pointers can be used to access and modify the local variables from another function. In order to do that the address of the variable is passed to the function. Then the value of the variable is changed inside of the function using its address. The main advantage of using pointers is that a function can return (change) more then one value. /* an example of a function prototype function will receive an address and store it into a pointer p */ int func2(int *p, double *p_num, int another_num); /* an example of a function call sending an address to the function */ num = func2(&x, &y, z); *p = 77; int func2(int *p, double *p_num, int another_num){ *p_num = 56. 34; another_num += *p; return another_num 5; *p = 88; x = *p + 2; /* determine the exact output of the following program. /* write the output of this c program.

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

Related Documents

Related Questions