Posts

Showing posts with the label Easy

Linked list insertion insertion and display

#include<stdio.h> #include<stdlib.h> struct node {     int data;     struct node *next; }; typedef struct node node; //functionto create a linked list node * createLinkedlist(int n); void display(node *start); int main() {     int n=0;     node *head=NULL;     node * HEAD =NULL; //address of first node     printf("ENter Number of nodes : ");     scanf("%d",&n);     HEAD = createLinkedlist(n);     display(HEAD);     return 0; } node *createLinkedlist(int n) {     int i=0;     node *head=NULL;     node *temp=NULL;     node *p = NULL;     for(i=0;i<n;i++)     {         //create indibidual isolated nodes         temp=(node*)malloc(sizeof(node));         printf("enter data for %d",(i+1));         scanf("%d",&temp->data);   ...