Just a quick question, can we put an address as a function argument like int f(int &x){...} ?????? (Pleaase tell me we can't😭) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

Just a quick question, can we put an address as a function argument like int f(int &x){...} ?????? (Pleaase tell me we can't😭)

If we can than what is the difference between it and f(int *x){...} Actually our professor put on exam a code like: int f(int &x, int *y){x+=10 ;... return x;} int main(){...int a=3,b=1; printf("%d %d", f(a,&b),a); ... return 0;}something like this. then told us write the out put f(a,b)=?. a=? /*BTW I answered there is an error in the code🤓🤓*/

11th Sep 2019, 10:28 AM
Hadjer
Hadjer - avatar
2 Answers
+ 5
~ swim ~ it's in C. Thank you so much @~ swim ~
11th Sep 2019, 10:50 AM
Hadjer
Hadjer - avatar
+ 1
We cannot take address in function as arguments in C. It will obviously throw an error.
14th Sep 2019, 10:01 AM
Sagnik Ray
Sagnik Ray - avatar