Tuesday, July 20, 2010

Create the first node of a single linked list?

Hi experts!





I need a 'C' program for "creating the first node of a single linked list"


Anyone help me to give the complete source code for it.

Create the first node of a single linked list?
struct stud *head=(struct stud*)malloc(sizeof(struct stud));


clrscr( );


ans='y';





printf("\nEnter :");


scanf("%d",%26amp;head-%26gt;a);


trail=head;


printf("\nEnter another? [y/n] ");


ans=getche( );





while ((ans=='y')||(ans=='Y')){


struct stud *t=(struct stud*)malloc(sizeof(struct stud));


trail-%26gt;sp=t;


printf("\n\nEnter :");


scanf("%d",%26amp;t-%26gt;a);


trail=t;


trail-%26gt;sp=NULL;


printf("\nEnter another? [y/n] ");


ans=getche( );


}

sliders

No comments:

Post a Comment