Again I am having pointer troubles.
The compiler returns the following errors:Code:#include <stdio.h> typedef struct { int a; char c; } Test; typedef Test *TestPtr; int main () { Test t; TestPtr p; p = &t; *p.a = 2; *p.c = 'k'; printf("%d",t.a); printf("%c",t.c); getchar(); return 0; }
- request for member `a' in something not a structure or union
- request for member `c' in something not a structure or union
I found in a Google search a way to do this in Classic C, but not in ANSI C. Not sure I know the correct way to do this, and my book (although otherwise brilliant) doesn't either.
Adam.