Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions C/LinkedListImplementation.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#include<stdio.h>
#include<stdlib.h>
struct node{
int data;
struct node *next;
};
typedef struct node NODE;
NODE *head=NULL;
NODE *end=NULL;

void create( int data){
NODE *temp;
temp =(NODE*)malloc(sizeof(NODE));
temp->data=data;
if(head==NULL){
head=temp;
end=temp;
}
else{
end->next=temp;
end=temp;
temp->next=NULL;

}
}
void display(){
NODE *temp;
temp = head;
while(temp!=NULL){
printf("%d", temp->data);
printf(" \n");
temp=temp->next;
}
}

int main(){
int n;
printf(" Enter the number of nodes in list:");
scanf(" %d", &n);
for(int i=0; i<n; i++){
int data;
scanf("%d", &data);
create(data);

}

display();


return 0;
}