If C does not support passing a variable by reference, why does this work?
#include void f(int *j) { (*j)++; } int main() { int i = 20;
Because there is no pass-by-reference in the above code. Using pointers (such as void func(int* p)) is pass-by-address. This is pass-by-reference in C++ (won't work in C):
void func(int* p)
void func(int& ref) {ref = 4;} ... int a; func(a); // a is 4 now