I am compiling this piece of code and I get compliation errors saying " dereferencing pointer to incomplete type" . I get the errors for the last print statement and before that where I try to point (*temp). num to the address of b
Here's the code snippet:
void main()
{
struct {
int xx;
char *y;
int * num;
struct x *next;
}x;
struct x* temp;
int b = 10;
temp = ((struct x *)malloc(sizeof(x)));
(*temp).num = &b;
x.next = temp ;
printf(" %d\n",temp->num, x.next->num);
}