How to Inserting a many nodes in a linked list
Here is my code.
20Code:#include <stdio.h>#include <stdlib.h> struct node { int data; struct node *next; }; struct node* front(struct node *head, int value) { struct node *p; p=malloc(sizeof(struct node)); p->data=value; p->next=head; return (p); } int main(void) { struct node *head = NULL; head=front(head,10); if(head == NULL) { printf("NULL\n"); } else { printf("%d\n", head -> data); } return 0; }
Could anyone help me with this.