Quantcast
Channel: CodeChef Discuss - latest questions
Viewing all articles
Browse latest Browse all 40121

PLZ HELP TO GET THE OUTPUT FOR THIS PROGRAM

$
0
0

include<stdio.h>

include<conio.h>

include<stdlib.h>

struct node{ int data; struct node *next; };

void insert(struct node h) { struct node t,l; int d; t=(struct node)malloc(sizeof(struct node)); printf("enter the vlue"); scanf("%d",&d); if(h==NULL) { t->data=d; t->next=NULL; h=t; l=t; } else { l->next=t; t->data=d; t->next=NULL; } } void display(struct node h) { while(h!=NULL) { printf("%5d ",h->data); h=h->next; } } int main() { struct node h=NULL; char m; while(1) { clrscr(); printf("\n 1.insert"); printf("\n 2.display"); printf("\nenter 3 for exit"); printf("\nenter choice"); scanf("%c",&m); switch(m) { case '1':insert(h); break; case '2':display(h); break; case '3':return(0); }

getch(); } }


Viewing all articles
Browse latest Browse all 40121

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>