Given the following code:
Why do I get an error when compiling?Code:#include <stdio.h>
#include <stdlib.h>
typedef struct foo {
int test;
char b;
} foo;
int
main(int argc, char *argv[]) {
foo f = {2, 'c'};
int i = f->test;
printf("%d\n", i);
return 0;
}
test.c: In function 'main':
test.c:13: error: invalid type argument of '->'
When I use decimal notation, such as f.test, it works fine.