Pass by reference in C99

I just read this :

In C ++ (and C99), we can bypass a link that offers the same performance as an index pass.

So, I tried this simple code:

#include <stdio.h>

void blabla(int& x){
    x = 5;
}

int main(){
    int y = 3;
    printf("y = %d\n", y);
    blabla(y);
    printf("y = %d\n", y);
}

The output was:

gcc test.c -o test -std=c99
test.c:3:16: error: expected ';', ',' or ')' before '&' token
test.c: In function 'main': 
test.c:10:2: warning: implicit declaration of function 'blabla'

Now I am confused. Is link skipping supported by C99?

+3
source share
1 answer

This page is incorrect. There are no "references" in C (even to C99).

In C, when you want to pass "by reference", you fake reference semantics with a pointer.

+4
source

All Articles