I can't understand why I get the following errors.
Here is my code:
Code:
union header{ /* block header [LINE 11] */
struct{
unsigned int size; /* size of this block */
int prev_check = 0;
union header *ptr; /* next block if on free list */
} s;
Align x; /* force alignment of blocks */
};
typedef union header Header; /*[LINE 20]*/
These are the errors that I get:
Code:
mymalloc.c:14: warning: no semicolon at end of struct or union
mymalloc.c:14: error: syntax error before '=' token
mymalloc.c:14: warning: no semicolon at end of struct or union
mymalloc.c:17: error: syntax error before '}' token
mymalloc.c:17: warning: data definition has no type or storage class
mymalloc.c:19: error: syntax error before '}' token
I am getting this error just by declaring a variable: int prev_check. I wont get these errors when I remove that line. Please advise.