Okay I know right off the bat this is going to be a stupid question, but I am not seeing why this simple C program is not compiling.
#include <stdio.h>
#include <stdlib.h>
typdef struct CELL *LIST;
struct CELL {
int element;
LIST next;
};
main() {
struct CELL *value;
printf("Hello, World!");
}
I am new to C programming, not to programming in general, but to C. I am familiar with Objective-C, Java, Matlab, and a few others, but for some reason I can not figure this one out. I am trying to compile it using GCC in OS X if that makes a difference. Thanks for your help!
The error message I am getting is
functionTest.c:5: error: expected specifier-qualifier-list before ‘LIST’
functionTest.c:7: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘struct’
Most importantly: You have misspelled typedef.
Then, at least these days, we normally add a return type to main, like so:
int main()
Also, main is supposed to return the exit status, so:
#include <stdio.h>
#include <stdlib.h>
typedef struct CELL *LIST;
struct CELL {
int element;
LIST next;
};
int main() {
struct CELL *value;
printf("Hello, World!\n");
return 0;
}