passing by refrence isn't allowed in C?
I was looking at my old C++ book and it said one of the differences between C and C++ was that in C you couldn't pass by reference (I always did by pointers, so it didn't apply to me fully) but I tried it out and I was surprised. How come this works on C++ but not C?
Code:
#include <stdio.h>
int blah(int &a, int &b)
{
int c;
c = a;
a = b;
b = c;
return 0;
}
int main()
{
int a[2];
a[0] = 34;
a[1] = 32;
printf("a = %d\nb = %d",a[0],a[1]);
blah(a[0],a[1]);
printf("a = %d\nb = %d",a[0],a[1]);
return 0;
}