SlideShare ist ein Scribd-Unternehmen logo
1 von 3
Downloaden Sie, um offline zu lesen
S3-1
Write a program in ‘C’ language for the creation of a list.
Also, write a procedure for deletion of an element from the list.
Use pointers
#include <stdio.h>
#define NULL 0
struct student
{
char name[15];
int roll_no;
struct student *next;
}*stud,*first;
/*creation of list*/
void list_create(struct student *s1)
{
printf("Enter roll number:-1 to terminaten");
scanf("%d",&s1->roll_no);
if(s1->roll_no!=-1)
{
printf("Enter name: ");
scanf("%s",s1->name);
s1->next=(struct student*)malloc(sizeof(struct student));
list_create(s1->next);
}
else
{
s1->next=NULL;
return;
}
}
/*Display the list */
display_list(struct student *s1)
{
if(first->next==NULL)
{
printf("List is empty");
getch();
return;
}
while(s1->next)
{
printf("%dt%sn",s1->roll_no,s1->name);
s1=s1->next;
}
getch();
return;
}
/*Delete from list */
void delete_element(struct student *start)
{
struct student *temp,*t;
int roll,flag=0;
if(first->next==NULL)
Page 1
S3-1
{
printf("List empty");
getch();
return ;
}
printf("Enter rollnumber to deleten");
scanf("%d",&roll);
if(start->roll_no==roll)
{
temp=start->next;
free(start);
first=temp;
return ;
}
/* any other node */
t=start;/*store previous node t*/
start=start->next; /*point next node */
while(start)
{
if(start->roll_no==roll)
{
temp=start->next;
free(start);
t->next=temp;
return;
}
t=t->next;
start=start->next;
flag=1;
}
if(flag==1)
{
printf("Rollnumber not found");
getch();
return;
}
}
void main()
{
int choice=0;
clrscr();
stud=(struct student*)malloc(sizeof(struct student));
first=stud;
first->next=NULL;
while(choice!=4)
{
clrscr();
printf("MENUnn");
printf("Create....1nnDisplay...2nnDelete...3nnExit...4nn");
printf("Enter choicen");
scanf("%d",&choice);
switch(choice)
Page 2
S3-1
{
case 1:
list_create(stud);
break;
case 2:
display_list(stud);
break;
case 3:
delete_element(stud);
break;
case 4: break;
}
}
getch();
return ;
}
Page 3

Weitere ähnliche Inhalte

Was ist angesagt?

Was ist angesagt? (20)

Bcsl 033 data and file structures lab s5-3
Bcsl 033 data and file structures lab s5-3Bcsl 033 data and file structures lab s5-3
Bcsl 033 data and file structures lab s5-3
 
Program in ‘C’ language to implement linear search using pointers
Program in ‘C’ language to implement linear search using pointersProgram in ‘C’ language to implement linear search using pointers
Program in ‘C’ language to implement linear search using pointers
 
Bcsl 033 data and file structures lab s1-3
Bcsl 033 data and file structures lab s1-3Bcsl 033 data and file structures lab s1-3
Bcsl 033 data and file structures lab s1-3
 
Bcsl 033 data and file structures lab s5-2
Bcsl 033 data and file structures lab s5-2Bcsl 033 data and file structures lab s5-2
Bcsl 033 data and file structures lab s5-2
 
week-1x
week-1xweek-1x
week-1x
 
week-10x
week-10xweek-10x
week-10x
 
SATySFiのこれからの課題たち
SATySFiのこれからの課題たちSATySFiのこれからの課題たち
SATySFiのこれからの課題たち
 
week-11x
week-11xweek-11x
week-11x
 
One dimensional operation of Array in C- language
One dimensional operation of Array in C- language One dimensional operation of Array in C- language
One dimensional operation of Array in C- language
 
C Programming Example
C Programming Example C Programming Example
C Programming Example
 
C Programming Example
C Programming ExampleC Programming Example
C Programming Example
 
C Programming Language Part 11
C Programming Language Part 11C Programming Language Part 11
C Programming Language Part 11
 
Computer programing w
Computer programing wComputer programing w
Computer programing w
 
Dti2143 lab sheet 9
Dti2143 lab sheet 9Dti2143 lab sheet 9
Dti2143 lab sheet 9
 
Examples sandhiya class'
Examples sandhiya class'Examples sandhiya class'
Examples sandhiya class'
 
Switch
SwitchSwitch
Switch
 
Bcsl 033 data and file structures lab s1-4
Bcsl 033 data and file structures lab s1-4Bcsl 033 data and file structures lab s1-4
Bcsl 033 data and file structures lab s1-4
 
week-4x
week-4xweek-4x
week-4x
 
week-6x
week-6xweek-6x
week-6x
 
C program to check leap year
C program to check leap year C program to check leap year
C program to check leap year
 

Andere mochten auch

Who Wrote this $#!7: Authorship and Semantic Web Markup for SEO and Social Me...
Who Wrote this $#!7: Authorship and Semantic Web Markup for SEO and Social Me...Who Wrote this $#!7: Authorship and Semantic Web Markup for SEO and Social Me...
Who Wrote this $#!7: Authorship and Semantic Web Markup for SEO and Social Me...Nick Moline
 
European empires and conquest
European empires and conquestEuropean empires and conquest
European empires and conquestsantana_dianag
 
Guide To Qrops Pension Planning
Guide To Qrops Pension PlanningGuide To Qrops Pension Planning
Guide To Qrops Pension Planninggregsmithhk
 
The story of_intenet_1
The story of_intenet_1The story of_intenet_1
The story of_intenet_1Jorgelcb
 
Justia and Amazon CloudSearch
Justia and Amazon CloudSearchJustia and Amazon CloudSearch
Justia and Amazon CloudSearchNick Moline
 
Who are SBS.doc
Who are SBS.docWho are SBS.doc
Who are SBS.docSally15
 
#ThroughGlass : An Introduction to Google Glass
#ThroughGlass : An Introduction to Google Glass#ThroughGlass : An Introduction to Google Glass
#ThroughGlass : An Introduction to Google GlassNick Moline
 
Sarcs sexii power point final
Sarcs sexii power point finalSarcs sexii power point final
Sarcs sexii power point finalMichael Greenwell
 
Individual differences and call ppt
Individual differences and call pptIndividual differences and call ppt
Individual differences and call pptgianbisa
 
Clipacevedoslideshare 091126171514-phpapp01
Clipacevedoslideshare 091126171514-phpapp01Clipacevedoslideshare 091126171514-phpapp01
Clipacevedoslideshare 091126171514-phpapp01liveware82
 
Providing Access for Spanish Speaking Patrons
Providing Access for Spanish Speaking PatronsProviding Access for Spanish Speaking Patrons
Providing Access for Spanish Speaking Patronstomastoro
 
The Afterburner - Optimizing Drupal for Speed and SEO
The Afterburner - Optimizing Drupal for Speed and SEOThe Afterburner - Optimizing Drupal for Speed and SEO
The Afterburner - Optimizing Drupal for Speed and SEONick Moline
 
まちづくりと復興について
まちづくりと復興についてまちづくりと復興について
まちづくりと復興についてJunichi Toyoshima
 
world with problem
world with problemworld with problem
world with problemarcjoan
 

Andere mochten auch (20)

Ning post #3
Ning post #3Ning post #3
Ning post #3
 
Who Wrote this $#!7: Authorship and Semantic Web Markup for SEO and Social Me...
Who Wrote this $#!7: Authorship and Semantic Web Markup for SEO and Social Me...Who Wrote this $#!7: Authorship and Semantic Web Markup for SEO and Social Me...
Who Wrote this $#!7: Authorship and Semantic Web Markup for SEO and Social Me...
 
DJKrush
DJKrushDJKrush
DJKrush
 
European empires and conquest
European empires and conquestEuropean empires and conquest
European empires and conquest
 
Ning post #2
Ning post #2Ning post #2
Ning post #2
 
Guide To Qrops Pension Planning
Guide To Qrops Pension PlanningGuide To Qrops Pension Planning
Guide To Qrops Pension Planning
 
The story of_intenet_1
The story of_intenet_1The story of_intenet_1
The story of_intenet_1
 
Justia and Amazon CloudSearch
Justia and Amazon CloudSearchJustia and Amazon CloudSearch
Justia and Amazon CloudSearch
 
Who are SBS.doc
Who are SBS.docWho are SBS.doc
Who are SBS.doc
 
#ThroughGlass : An Introduction to Google Glass
#ThroughGlass : An Introduction to Google Glass#ThroughGlass : An Introduction to Google Glass
#ThroughGlass : An Introduction to Google Glass
 
Sarcs sexii power point final
Sarcs sexii power point finalSarcs sexii power point final
Sarcs sexii power point final
 
Individual differences and call ppt
Individual differences and call pptIndividual differences and call ppt
Individual differences and call ppt
 
Clipacevedoslideshare 091126171514-phpapp01
Clipacevedoslideshare 091126171514-phpapp01Clipacevedoslideshare 091126171514-phpapp01
Clipacevedoslideshare 091126171514-phpapp01
 
Moby
MobyMoby
Moby
 
Ning post #4
Ning post #4Ning post #4
Ning post #4
 
Providing Access for Spanish Speaking Patrons
Providing Access for Spanish Speaking PatronsProviding Access for Spanish Speaking Patrons
Providing Access for Spanish Speaking Patrons
 
The Afterburner - Optimizing Drupal for Speed and SEO
The Afterburner - Optimizing Drupal for Speed and SEOThe Afterburner - Optimizing Drupal for Speed and SEO
The Afterburner - Optimizing Drupal for Speed and SEO
 
Ning post 2
Ning post 2Ning post 2
Ning post 2
 
まちづくりと復興について
まちづくりと復興についてまちづくりと復興について
まちづくりと復興について
 
world with problem
world with problemworld with problem
world with problem
 

Ähnlich wie Bcsl 033 data and file structures lab s3-1

Singly linked list.pptx
Singly linked list.pptxSingly linked list.pptx
Singly linked list.pptxSanthiya S
 
There are a number of errors in the following program- All errors are.docx
There are a number of errors in the following program- All errors are.docxThere are a number of errors in the following program- All errors are.docx
There are a number of errors in the following program- All errors are.docxclarkjanyce
 
C basics
C basicsC basics
C basicsMSc CST
 
Basic c programs updated on 31.8.2020
Basic c programs updated on 31.8.2020Basic c programs updated on 31.8.2020
Basic c programs updated on 31.8.2020vrgokila
 
For this homework, you will write a program to create and manipulate.pdf
For this homework, you will write a program to create and manipulate.pdfFor this homework, you will write a program to create and manipulate.pdf
For this homework, you will write a program to create and manipulate.pdfherminaherman
 
Program of sorting using shell sort #include stdio.h #de.pdf
 Program of sorting using shell sort  #include stdio.h #de.pdf Program of sorting using shell sort  #include stdio.h #de.pdf
Program of sorting using shell sort #include stdio.h #de.pdfanujmkt
 
Datastructures asignment
Datastructures asignmentDatastructures asignment
Datastructures asignmentsreekanth3dce
 
data structure and algorithm.pdf
data structure and algorithm.pdfdata structure and algorithm.pdf
data structure and algorithm.pdfAsrinath1
 
Single linked list
Single linked listSingle linked list
Single linked listSayantan Sur
 
Data Structure Project File
Data Structure Project FileData Structure Project File
Data Structure Project FileDeyvessh kumar
 
Data Structure in C Programming Language
Data Structure in C Programming LanguageData Structure in C Programming Language
Data Structure in C Programming LanguageArkadeep Dey
 
An imperative study of c
An imperative study of cAn imperative study of c
An imperative study of cTushar B Kute
 
Data structure week 3
Data structure week 3Data structure week 3
Data structure week 3karmuhtam
 
Presentation on structure,functions and classes
Presentation on structure,functions and classesPresentation on structure,functions and classes
Presentation on structure,functions and classesAlisha Korpal
 
Circular linked list
Circular linked listCircular linked list
Circular linked listSayantan Sur
 
VTU DSA Lab Manual
VTU DSA Lab ManualVTU DSA Lab Manual
VTU DSA Lab ManualAkhilaaReddy
 

Ähnlich wie Bcsl 033 data and file structures lab s3-1 (20)

Singly linked list.pptx
Singly linked list.pptxSingly linked list.pptx
Singly linked list.pptx
 
There are a number of errors in the following program- All errors are.docx
There are a number of errors in the following program- All errors are.docxThere are a number of errors in the following program- All errors are.docx
There are a number of errors in the following program- All errors are.docx
 
Final ds record
Final ds recordFinal ds record
Final ds record
 
C basics
C basicsC basics
C basics
 
Basic c programs updated on 31.8.2020
Basic c programs updated on 31.8.2020Basic c programs updated on 31.8.2020
Basic c programs updated on 31.8.2020
 
For this homework, you will write a program to create and manipulate.pdf
For this homework, you will write a program to create and manipulate.pdfFor this homework, you will write a program to create and manipulate.pdf
For this homework, you will write a program to create and manipulate.pdf
 
VTU Data Structures Lab Manual
VTU Data Structures Lab ManualVTU Data Structures Lab Manual
VTU Data Structures Lab Manual
 
Program of sorting using shell sort #include stdio.h #de.pdf
 Program of sorting using shell sort  #include stdio.h #de.pdf Program of sorting using shell sort  #include stdio.h #de.pdf
Program of sorting using shell sort #include stdio.h #de.pdf
 
Datastructures asignment
Datastructures asignmentDatastructures asignment
Datastructures asignment
 
data structure and algorithm.pdf
data structure and algorithm.pdfdata structure and algorithm.pdf
data structure and algorithm.pdf
 
C program to implement linked list using array abstract data type
C program to implement linked list using array abstract data typeC program to implement linked list using array abstract data type
C program to implement linked list using array abstract data type
 
Single linked list
Single linked listSingle linked list
Single linked list
 
Data Structure Project File
Data Structure Project FileData Structure Project File
Data Structure Project File
 
Data Structure in C Programming Language
Data Structure in C Programming LanguageData Structure in C Programming Language
Data Structure in C Programming Language
 
An imperative study of c
An imperative study of cAn imperative study of c
An imperative study of c
 
Data structure week 3
Data structure week 3Data structure week 3
Data structure week 3
 
week-15x
week-15xweek-15x
week-15x
 
Presentation on structure,functions and classes
Presentation on structure,functions and classesPresentation on structure,functions and classes
Presentation on structure,functions and classes
 
Circular linked list
Circular linked listCircular linked list
Circular linked list
 
VTU DSA Lab Manual
VTU DSA Lab ManualVTU DSA Lab Manual
VTU DSA Lab Manual
 

Mehr von Dr. Loganathan R

Ch 6 IoT Processing Topologies and Types.pdf
Ch 6 IoT Processing Topologies and Types.pdfCh 6 IoT Processing Topologies and Types.pdf
Ch 6 IoT Processing Topologies and Types.pdfDr. Loganathan R
 
IoT Sensing and Actuation.pdf
 IoT Sensing and Actuation.pdf IoT Sensing and Actuation.pdf
IoT Sensing and Actuation.pdfDr. Loganathan R
 
Bcsl 033 data and file structures lab s4-3
Bcsl 033 data and file structures lab s4-3Bcsl 033 data and file structures lab s4-3
Bcsl 033 data and file structures lab s4-3Dr. Loganathan R
 
Bcsl 033 data and file structures lab s1-2
Bcsl 033 data and file structures lab s1-2Bcsl 033 data and file structures lab s1-2
Bcsl 033 data and file structures lab s1-2Dr. Loganathan R
 
Introduction to Information Security
Introduction to Information SecurityIntroduction to Information Security
Introduction to Information SecurityDr. Loganathan R
 
Mcs 012 computer organisation and assemly language programming- ignou assignm...
Mcs 012 computer organisation and assemly language programming- ignou assignm...Mcs 012 computer organisation and assemly language programming- ignou assignm...
Mcs 012 computer organisation and assemly language programming- ignou assignm...Dr. Loganathan R
 
Session 9 4 alp to display the current system time using dos int 21 h
Session 9  4 alp to display the current system time using dos int 21 hSession 9  4 alp to display the current system time using dos int 21 h
Session 9 4 alp to display the current system time using dos int 21 hDr. Loganathan R
 
Session 9 1 alp to compute a grade using procedures
Session 9   1 alp to compute a grade using proceduresSession 9   1 alp to compute a grade using procedures
Session 9 1 alp to compute a grade using proceduresDr. Loganathan R
 
IGNOU Assembly Language Programming
IGNOU Assembly Language ProgrammingIGNOU Assembly Language Programming
IGNOU Assembly Language ProgrammingDr. Loganathan R
 
Requirement engineering process
Requirement engineering processRequirement engineering process
Requirement engineering processDr. Loganathan R
 
MCS 012 computer organisation and assembly language programming assignment…
MCS 012 computer organisation and assembly language programming assignment…MCS 012 computer organisation and assembly language programming assignment…
MCS 012 computer organisation and assembly language programming assignment…Dr. Loganathan R
 
Software engineering critical systems
Software engineering   critical systemsSoftware engineering   critical systems
Software engineering critical systemsDr. Loganathan R
 
Software engineering socio-technical systems
Software engineering   socio-technical systemsSoftware engineering   socio-technical systems
Software engineering socio-technical systemsDr. Loganathan R
 
Software engineering introduction
Software engineering   introductionSoftware engineering   introduction
Software engineering introductionDr. Loganathan R
 

Mehr von Dr. Loganathan R (17)

Ch 6 IoT Processing Topologies and Types.pdf
Ch 6 IoT Processing Topologies and Types.pdfCh 6 IoT Processing Topologies and Types.pdf
Ch 6 IoT Processing Topologies and Types.pdf
 
IoT Sensing and Actuation.pdf
 IoT Sensing and Actuation.pdf IoT Sensing and Actuation.pdf
IoT Sensing and Actuation.pdf
 
Ch 4 Emergence of IoT.pdf
Ch 4 Emergence of IoT.pdfCh 4 Emergence of IoT.pdf
Ch 4 Emergence of IoT.pdf
 
Bcsl 033 data and file structures lab s4-3
Bcsl 033 data and file structures lab s4-3Bcsl 033 data and file structures lab s4-3
Bcsl 033 data and file structures lab s4-3
 
Bcsl 033 data and file structures lab s1-2
Bcsl 033 data and file structures lab s1-2Bcsl 033 data and file structures lab s1-2
Bcsl 033 data and file structures lab s1-2
 
Introduction to Information Security
Introduction to Information SecurityIntroduction to Information Security
Introduction to Information Security
 
Mcs 012 computer organisation and assemly language programming- ignou assignm...
Mcs 012 computer organisation and assemly language programming- ignou assignm...Mcs 012 computer organisation and assemly language programming- ignou assignm...
Mcs 012 computer organisation and assemly language programming- ignou assignm...
 
Session 9 4 alp to display the current system time using dos int 21 h
Session 9  4 alp to display the current system time using dos int 21 hSession 9  4 alp to display the current system time using dos int 21 h
Session 9 4 alp to display the current system time using dos int 21 h
 
Session 9 1 alp to compute a grade using procedures
Session 9   1 alp to compute a grade using proceduresSession 9   1 alp to compute a grade using procedures
Session 9 1 alp to compute a grade using procedures
 
IGNOU Assembly Language Programming
IGNOU Assembly Language ProgrammingIGNOU Assembly Language Programming
IGNOU Assembly Language Programming
 
Requirement engineering process
Requirement engineering processRequirement engineering process
Requirement engineering process
 
MCS 012 computer organisation and assembly language programming assignment…
MCS 012 computer organisation and assembly language programming assignment…MCS 012 computer organisation and assembly language programming assignment…
MCS 012 computer organisation and assembly language programming assignment…
 
Software requirements
Software requirementsSoftware requirements
Software requirements
 
Software process
Software processSoftware process
Software process
 
Software engineering critical systems
Software engineering   critical systemsSoftware engineering   critical systems
Software engineering critical systems
 
Software engineering socio-technical systems
Software engineering   socio-technical systemsSoftware engineering   socio-technical systems
Software engineering socio-technical systems
 
Software engineering introduction
Software engineering   introductionSoftware engineering   introduction
Software engineering introduction
 

Kürzlich hochgeladen

Team Lead Succeed – Helping you and your team achieve high-performance teamwo...
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...Team Lead Succeed – Helping you and your team achieve high-performance teamwo...
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...Association for Project Management
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptxmary850239
 
How to Make a Duplicate of Your Odoo 17 Database
How to Make a Duplicate of Your Odoo 17 DatabaseHow to Make a Duplicate of Your Odoo 17 Database
How to Make a Duplicate of Your Odoo 17 DatabaseCeline George
 
4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptxmary850239
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxHumphrey A Beña
 
4.11.24 Mass Incarceration and the New Jim Crow.pptx
4.11.24 Mass Incarceration and the New Jim Crow.pptx4.11.24 Mass Incarceration and the New Jim Crow.pptx
4.11.24 Mass Incarceration and the New Jim Crow.pptxmary850239
 
Mental Health Awareness - a toolkit for supporting young minds
Mental Health Awareness - a toolkit for supporting young mindsMental Health Awareness - a toolkit for supporting young minds
Mental Health Awareness - a toolkit for supporting young mindsPooky Knightsmith
 
Concurrency Control in Database Management system
Concurrency Control in Database Management systemConcurrency Control in Database Management system
Concurrency Control in Database Management systemChristalin Nelson
 
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITWQ-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITWQuiz Club NITW
 
ClimART Action | eTwinning Project
ClimART Action    |    eTwinning ProjectClimART Action    |    eTwinning Project
ClimART Action | eTwinning Projectjordimapav
 
Scientific Writing :Research Discourse
Scientific  Writing :Research  DiscourseScientific  Writing :Research  Discourse
Scientific Writing :Research DiscourseAnita GoswamiGiri
 
Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...
Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...
Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...DhatriParmar
 
Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4JOYLYNSAMANIEGO
 
ICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfVanessa Camilleri
 
Unraveling Hypertext_ Analyzing Postmodern Elements in Literature.pptx
Unraveling Hypertext_ Analyzing  Postmodern Elements in  Literature.pptxUnraveling Hypertext_ Analyzing  Postmodern Elements in  Literature.pptx
Unraveling Hypertext_ Analyzing Postmodern Elements in Literature.pptxDhatriParmar
 
Congestive Cardiac Failure..presentation
Congestive Cardiac Failure..presentationCongestive Cardiac Failure..presentation
Congestive Cardiac Failure..presentationdeepaannamalai16
 
Using Grammatical Signals Suitable to Patterns of Idea Development
Using Grammatical Signals Suitable to Patterns of Idea DevelopmentUsing Grammatical Signals Suitable to Patterns of Idea Development
Using Grammatical Signals Suitable to Patterns of Idea Developmentchesterberbo7
 
DIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptx
DIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptxDIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptx
DIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptxMichelleTuguinay1
 
MS4 level being good citizen -imperative- (1) (1).pdf
MS4 level   being good citizen -imperative- (1) (1).pdfMS4 level   being good citizen -imperative- (1) (1).pdf
MS4 level being good citizen -imperative- (1) (1).pdfMr Bounab Samir
 

Kürzlich hochgeladen (20)

Team Lead Succeed – Helping you and your team achieve high-performance teamwo...
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...Team Lead Succeed – Helping you and your team achieve high-performance teamwo...
Team Lead Succeed – Helping you and your team achieve high-performance teamwo...
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx
 
How to Make a Duplicate of Your Odoo 17 Database
How to Make a Duplicate of Your Odoo 17 DatabaseHow to Make a Duplicate of Your Odoo 17 Database
How to Make a Duplicate of Your Odoo 17 Database
 
4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
 
4.11.24 Mass Incarceration and the New Jim Crow.pptx
4.11.24 Mass Incarceration and the New Jim Crow.pptx4.11.24 Mass Incarceration and the New Jim Crow.pptx
4.11.24 Mass Incarceration and the New Jim Crow.pptx
 
Mental Health Awareness - a toolkit for supporting young minds
Mental Health Awareness - a toolkit for supporting young mindsMental Health Awareness - a toolkit for supporting young minds
Mental Health Awareness - a toolkit for supporting young minds
 
Concurrency Control in Database Management system
Concurrency Control in Database Management systemConcurrency Control in Database Management system
Concurrency Control in Database Management system
 
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITWQ-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
Q-Factor HISPOL Quiz-6th April 2024, Quiz Club NITW
 
ClimART Action | eTwinning Project
ClimART Action    |    eTwinning ProjectClimART Action    |    eTwinning Project
ClimART Action | eTwinning Project
 
prashanth updated resume 2024 for Teaching Profession
prashanth updated resume 2024 for Teaching Professionprashanth updated resume 2024 for Teaching Profession
prashanth updated resume 2024 for Teaching Profession
 
Scientific Writing :Research Discourse
Scientific  Writing :Research  DiscourseScientific  Writing :Research  Discourse
Scientific Writing :Research Discourse
 
Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...
Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...
Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...
 
Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4
 
ICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdf
 
Unraveling Hypertext_ Analyzing Postmodern Elements in Literature.pptx
Unraveling Hypertext_ Analyzing  Postmodern Elements in  Literature.pptxUnraveling Hypertext_ Analyzing  Postmodern Elements in  Literature.pptx
Unraveling Hypertext_ Analyzing Postmodern Elements in Literature.pptx
 
Congestive Cardiac Failure..presentation
Congestive Cardiac Failure..presentationCongestive Cardiac Failure..presentation
Congestive Cardiac Failure..presentation
 
Using Grammatical Signals Suitable to Patterns of Idea Development
Using Grammatical Signals Suitable to Patterns of Idea DevelopmentUsing Grammatical Signals Suitable to Patterns of Idea Development
Using Grammatical Signals Suitable to Patterns of Idea Development
 
DIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptx
DIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptxDIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptx
DIFFERENT BASKETRY IN THE PHILIPPINES PPT.pptx
 
MS4 level being good citizen -imperative- (1) (1).pdf
MS4 level   being good citizen -imperative- (1) (1).pdfMS4 level   being good citizen -imperative- (1) (1).pdf
MS4 level being good citizen -imperative- (1) (1).pdf
 

Bcsl 033 data and file structures lab s3-1

  • 1. S3-1 Write a program in ‘C’ language for the creation of a list. Also, write a procedure for deletion of an element from the list. Use pointers #include <stdio.h> #define NULL 0 struct student { char name[15]; int roll_no; struct student *next; }*stud,*first; /*creation of list*/ void list_create(struct student *s1) { printf("Enter roll number:-1 to terminaten"); scanf("%d",&s1->roll_no); if(s1->roll_no!=-1) { printf("Enter name: "); scanf("%s",s1->name); s1->next=(struct student*)malloc(sizeof(struct student)); list_create(s1->next); } else { s1->next=NULL; return; } } /*Display the list */ display_list(struct student *s1) { if(first->next==NULL) { printf("List is empty"); getch(); return; } while(s1->next) { printf("%dt%sn",s1->roll_no,s1->name); s1=s1->next; } getch(); return; } /*Delete from list */ void delete_element(struct student *start) { struct student *temp,*t; int roll,flag=0; if(first->next==NULL) Page 1
  • 2. S3-1 { printf("List empty"); getch(); return ; } printf("Enter rollnumber to deleten"); scanf("%d",&roll); if(start->roll_no==roll) { temp=start->next; free(start); first=temp; return ; } /* any other node */ t=start;/*store previous node t*/ start=start->next; /*point next node */ while(start) { if(start->roll_no==roll) { temp=start->next; free(start); t->next=temp; return; } t=t->next; start=start->next; flag=1; } if(flag==1) { printf("Rollnumber not found"); getch(); return; } } void main() { int choice=0; clrscr(); stud=(struct student*)malloc(sizeof(struct student)); first=stud; first->next=NULL; while(choice!=4) { clrscr(); printf("MENUnn"); printf("Create....1nnDisplay...2nnDelete...3nnExit...4nn"); printf("Enter choicen"); scanf("%d",&choice); switch(choice) Page 2
  • 3. S3-1 { case 1: list_create(stud); break; case 2: display_list(stud); break; case 3: delete_element(stud); break; case 4: break; } } getch(); return ; } Page 3