//A C PROGRAM TO CREATE S LINKED LIST
#include<stdio.h>
#include<stdlib.h>
struct node{
    int data;
    struct node *next;
};
int main(){
    struct node *node,*head=NULL,*temp=NULL;
    int i,size;
    printf("enter no of nodes:");
    scanf("%d",&size);
    for(i=0;i<size;i++){
    node=(struct node*)malloc(sizeof(struct node));
    node->next=NULL;
    if(node==NULL){
        printf("the allocation failed");
        return 0;
    }
    else{
        printf("enter%dnode data:",i+1);
        scanf("%d",&(node->data));
        if(head==NULL){
            head=node;
            temp=node;
        }
        else{
            temp->next=node;
            temp=temp->next;
        }
    }
    }
    //printing elements 
    temp=head;
    while(temp!=NULL){
        printf("->%d",temp->data);
        temp=temp->next;
    }
    
}