I am a newbie in C. I am trying to create a typedef struct outside of main and then create a pointer of typedef. Then pass this pointer into another function. However I am getting error. It is driving me crazy .Thank you very much in advance..
typedef struct rem_info
{
char ufrag[80];
char pwd[80];
unsigned comp_cnt;
pj_sockaddr def_addr[PJ_ICE_MAX_COMP];
unsigned cand_cnt;
pj_ice_sess_cand cand[PJ_ICE_ST_MAX_CAND];
} rem_info;
void reset_rem_info(rem_info *prem)
{
pj_bzero(prem, sizeof(rem_info));
}
int main()
{
rem_info *prem;
reset_rem_info(&prem);
return 0;
}
Error:
*WARNING**:ex7.c:51:1: warning: passing argument 1 of ‘reset_rem_info’ from incompatible pointer type [enabled by default]
reset_rem_info(&prem);
^
ex7.c:41:6: note: expected ‘struct rem_info *’ but argument is of type ‘struct rem_info **’
void reset_rem_info(rem_info *prem)
reset_rem_info(&prem);toreset_rem_info(prem);You don't need to dereference the pointer.