Here's the code:
On compilation, I get this error: "two or more data types in declaration of 'push'.Code:#include<stdio.h> #include<conio.h> struct node { int data; struct node *next; } void push(struct node **head_ref, int value) { struct node *new_node = (struct node*)malloc(sizeof(struct node)); new_node->data = value; new_node->next = (*head_ref); (*head_ref) = new_node; } int main(void) { struct node *head = NULL; push(&head, 10); getch(); return 0; }
Thanks in advance.