0% found this document useful (0 votes)
7 views2 pages

Student Roll Number Linked List Code

The document contains a C program that implements a linked list to manage student roll numbers. It allows users to append new roll numbers and display the list of roll numbers. However, there are some errors in the code, such as incorrect usage of the assignment operator and missing function declarations.

Uploaded by

gbrazil885
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views2 pages

Student Roll Number Linked List Code

The document contains a C program that implements a linked list to manage student roll numbers. It allows users to append new roll numbers and display the list of roll numbers. However, there are some errors in the code, such as incorrect usage of the assignment operator and missing function declarations.

Uploaded by

gbrazil885
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Coding

#include<stdio.h>
#include<conio.h>
typedef struct student
{ int roll;
struct student *next;
}node;
node *start=NULL;
void append();
void main()
{ int prompt;
do
{ printf("\n Supply 1 for insert and 0 for exit:");
scanf("%d",&prompt);
if(prompt==1)
{
void append();
}
} while(prompt!=0);
void display();
getch();
}
void append()
{ int data;
node *temp,*curr;
printf("/n Supply your roll number:");
scanf("%d",&data);
temp=(node *)malloc (sizeof(node));
temp->roll=data;
if(start=NULL)
{
start=temp;
temp->next=NULL;
}
else
{
curr=start;
while(curr->next!=NULL)
curr=curr->next;
curr->next=temp;
temp->next=NULL;
}
}
void display()
{ node *curr;
curr=start;
while(curr->next!=NULL)
{ printf("%d->",curr->roll);
curr=curr->next;
}
}

You might also like