this is probably a simple solution I am not that familiar with C just trying to port my java data structure assignments to C.
this is the error i am getting:
test.c:4: error: expected ‘)’ before ‘*’ token
test.c:11: error: expected ‘)’ before ‘*’ token
#include <stdio.h>
#include <stdlib.h>
void to_screen(NODE *cur){
while(cur->next != NULL){
printf("%d\n", cur->data);
cur = cur->next;
}
}
void add_first(NODE *head, int data){
NODE *cur;
int i;
for(i=0; i<10; i++){
cur = malloc(sizeof(NODE));
cur->data = data;
cur->next = (*head).next;
head->next = cur;
}
}
typedef struct node{
int data;
struct element *next;
}NODE;
int main(){
int i;
NODE *head;
for(i=0; i<10; i++){
add_first(head, i);
}
to_screen(head);
}