Creation of node:
struct Node
{
    int data;
    struct Node *link;
};
struct Node *head = NULL;
Append Function
int append()
{
    struct Node *temp;
    struct Node *p;
    temp = (struct Node *)malloc(sizeof(struct Node));
    printf("Enter the data");
    scanf("%d", &temp->data);
    
    if (head == NULL)
    {   temp->link = NULL;
        head = temp;
        
    }
    else
    {
         
        p = head;
        while (p != NULL)
        {
            p = p->link;
        }
     p->link=NULL;
    }
    return p->data;
}
Main Function
void main()
{
    int append();
    int insert();
    int insert_begin();
    int display();
    int delete ();
    int del_between();
    int k = 1, ch ,d;
    while (k)
    {
        printf("\nEnter choice\n");
        printf("1.Append\n");
        printf("2.In between\n");
        printf("3.At the beginning\n");
        printf("4.Display\n");
        printf("5.Delete\n");
        printf("6.Delete from between\n");
        printf("7.Quit\n");
        scanf("%d", &ch);
        switch (ch)
        {
        case 1:
            d = append();
            printf("pushed %d",d);
            break;
        case 2:
            insert();
            break;
        case 3:
            insert_begin();
            break;
        case 4:
            display();
            break;
        case 5:
            delete ();
            break;
        case 6:
            del_between();
            break;
        case 7:
            k = 0;
            break;
        default:
            printf("wrong choice");
        }
    }
}
I have been trying to append a node at the end of a linked list but as soon as I enter the data to be added Segmentation default error occurs.
Output screen
Enter choice
1.Append
2.In between
3.At the beginning
4.Display
5.Delete
6.Delete from between
7.Quit
1
Enter the data23
Segmentation fault
.........................................................................................................
What is the meaning of Segmentation fault ?How to get rid of it? Where am I going wrong? ................................................................................................................
Thanks.
 
    