Youssef Khloufi Youssef Khloufi - 1 year ago 100
C Question

error: expected ‘;’, ‘,’ or ‘)’ before ‘&’ token

I get this error in a C header file in this line :

char * getFechaHora(time_t & tiempoPuro);

In a C source code file i am including the header file and giving the function an implementation

char * getFechaHora(time_t &tiempoPuro){...}

also in my header file i am including correctly the "time.h" library.

Answer Source

In C, if char * getFechaHora, this is your function and the two (time_t & tiempoPuro) are arguments you should declare the function as:

char * getFechaHora(time_t, tiempoPuro);

else if the second is a variable, declare as

char * getFechaHora(time_t *tiempoPuro);
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download