Modify using the following C program to write to read 10 car plate number and its color. Sort and store the data in a

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

Modify using the following C program to write to read 10 car plate number and its color. Sort and store the data in a

Post by answerhappygod »

Modify using the following C program to write to read 10
car plate number and its color. Sort and store the data in a
Single linked list in ascending way. Print out the data.
#include <stdlib.h>
#include <stdio.h>
struct snode{
int

pla;
char
st;
struct
snode *rrk;
struct
snode *llk;
};
struct snode *opt=0, *pt, *p1,*p2;
int main()
{
int i,p,s;
for(i=0;i<5;i++){
scanf("%d %c",&p,&s);
printf("%d %c\n",p,s);
pt=(struct snode
*)malloc(sizeof(struct snode));
if(opt==0){//the first
node
pt->pla=p;
pt->st=s;
opt=pt;
}
printf("plat=%d st=%c
\n",pt->pla, pt->st);
}
}
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply