Hi,
I have the following program:
When I compile with gcc I got de following message:Code:#include <stdio.h> typedef struct { int id; union { struct { int major; int minor; } version; } data; } cli_struct; int main(void); int add(cli_struct *cli); int main(void) { int result; cli_struct cli; cli.id = 5; cli.data.version.minor = 15; result = add(&cli); printf("Add: %d\n", result); return(0); } int add(cli_struct *cli) { int result; result = cli->id + cli->data->version->minor; return(result); }
error: invalid type argument of `->'
How can I access the member "minor" inside the function "add"?
Thanks in advance for any answer.
Best regards,
Luis Vital