The following code shows how to Create and Display Singly Linked List in C.

// Linked List Implementation

#include <stdio.h>
#include <stdlib.h>
struct node{
    int data;
    struct node* next;
};
struct node* head=NULL;
int main()
{
     int d;
     struct node *p, *q;
     head=(struct node *)malloc(sizeof(struct node));
     printf("Enter data for head node: ");
     scanf("%d", &d);
     head->data=d;
     head->next=NULL;
     q=head;
     printf("Enter data for next node! To end, enter -99: ");
     while(1)
     {
         scanf("%d", &d);
         if(d==-99)
            break;
         p=(struct node *)malloc(sizeof(struct node));
         p->data=d;
         p->next=NULL;
         q->next=p;
         q=p;
     }  
         
             p=head;
     printf("\n\nNodes in the Linked List....\n");
     while(p!=NULL)
     {
         printf("%d ", p->data);
         p=p->next;
     }
    return 0;
}

Output

Singly Linked List Implementation in C Language
Singly Linked List Implementation in C Language

Further Reading

50+ C Programming Interview Questions and Answers

C Program to Find Factorial of a Number