Why in this code, an asterik has come after int ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Why in this code, an asterik has come after int ?

void swap( int* a, int* b) { int temp = *a; *a = *b; * b = temp; }

17th Apr 2019, 8:33 AM
Aryaveer Singh Rawat
Aryaveer Singh Rawat - avatar
2 Answers
+ 6
Review the pointers section of the c course. https://www.sololearn.com/learn/C/2933/?ref=app
17th Apr 2019, 9:36 AM
jay
jay - avatar
+ 4
a and b are pointers to integers which means that they are varaiables that contain the addresses of integer variables.
17th Apr 2019, 9:57 AM
Sonic
Sonic - avatar