C99 gcc
I keep getting this error. I have a struct outside main. And inside main I am trying to allocate on the stack using calloc. I can’t seem to find out what is wrong.
Thanks for any advice,
error: expected expression before ‘)’ token
/* global */ struct port_data_t { size_t task_id; pthread_t *thread_id; size_t start_port; size_t number_ports; } *port_data; /* main function */ struct port_data_t *port_data = (struct task_data_t*) calloc(4, sizeof(port_data*));
Should be
calloc(4, sizeof(*port_data)): Note * before var name.