Skip to content
RED SAGSkills
easy5 pts · first answer countsembedded-cpointers

Why swap needs pointers

Why does this swap function not change the caller's variables?

void swap(int a, int b) { int t = a; a = b; b = t; }
int x = 1, y = 2;
swap(x, y);
Choose one answer

Discussion 0

Join free to post in the discussion.

Related questions