Is there no reference variables in c as in c++? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Is there no reference variables in c as in c++?

int swap(int &,int &);why is this invalid in c?is call by reference only through pointers in c and not through reference variables as in c++?

29th Jul 2018, 5:18 AM
THE GAMER
THE GAMER - avatar
3 Answers
+ 9
We don't have reference variables or "aliases" in C. When we say "pass by reference" in C, we refer to the act of passing the pointer to a variable, to a function.
29th Jul 2018, 5:23 AM
Hatsy Rei
Hatsy Rei - avatar
+ 9
c has no reference variable rather than you can use pointer to work call by reference.. int swap(int *,int*) https://stackoverflow.com/questions/4305673/does-c-have-references
29th Jul 2018, 5:24 AM
Scooby
Scooby - avatar
+ 3
thanks for the confirmation ☺️
29th Jul 2018, 5:35 AM
THE GAMER
THE GAMER - avatar