Please explain this code

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Please explain this code

#includecstdio.h>
struct clientData
unsigned int accNum;
char lastNamel 151:
char firstName[10];
float balance:
int main(void)
FILE "cfptr;
int ch;
char filename( 201:
printf("ni Read from std input and write to std output \n");
printf("n2 Read from specified 11le and write to specified f1le"):
printf("\nenter your choice:");
scanf("d".&ch):
if (ch--2)
printf("enter the file name :"):
scanf("s",af1lename);
cfptr-fopen(f1lename, ""):
1f(cfptr--ULL)
puts("File could not be opened");
else
struct clientData client - (0." "." ".8.e};
printf("s","enter account number" "(1 to 100, e to end input");
scanf ("d".&client.accNum):
while(client.achum!-8)
printf( "s". "Vn Enter lastNane,firstName, balance"):
fscanf(stdin, "X14stosf",client.lastName, client.firstNane,client.balance);
printf( "s". "Vn Enter account number:"):
scanf("d",&client.accNum);
fseek(cfptr.(client.accNum-1)*sizeof(struct clientData),SEEK SET):
furite(&client,sizeof(struct clientData).1. cfptr):
fclose(cfptr);
else
struct cli
printf("is"."enter account number" "(1 to 100, e to end input"):
scanf ("d".&client.accNum):
hile(client.accNum!-0)
ta client - (0," "," ",8.0);
printf("s", "n Enter lastName, firstName, balance");
scanf("K14sk9stf",&client.1lastName, Bclient.firstNane, Sclient.balance);
printf("Xs"."\n Enter account number:"):
scanf("d",Bc1ient.accun);
printf( "s\t*s\txf".client.lastName,client.firstName,client.balance):
return 6;
Transcribed Image Text:#includecstdio.h> struct clientData unsigned int accNum; char lastNamel 151: char firstName[10]; float balance: int main(void) FILE "cfptr; int ch; char filename( 201: printf("ni Read from std input and write to std output \n"); printf("n2 Read from specified 11le and write to specified f1le"): printf("\nenter your choice:"); scanf("d".&ch): if (ch--2) printf("enter the file name :"): scanf("s",af1lename); cfptr-fopen(f1lename, ""): 1f(cfptr--ULL) puts("File could not be opened"); else struct clientData client - (0." "." ".8.e}; printf("s","enter account number" "(1 to 100, e to end input"); scanf ("d".&client.accNum): while(client.achum!-8) printf( "s". "Vn Enter lastNane,firstName, balance"): fscanf(stdin, "X14stosf",client.lastName, client.firstNane,client.balance); printf( "s". "Vn Enter account number:"): scanf("d",&client.accNum); fseek(cfptr.(client.accNum-1)*sizeof(struct clientData),SEEK SET): furite(&client,sizeof(struct clientData).1. cfptr): fclose(cfptr); else struct cli printf("is"."enter account number" "(1 to 100, e to end input"): scanf ("d".&client.accNum): hile(client.accNum!-0) ta client - (0," "," ",8.0); printf("s", "n Enter lastName, firstName, balance"); scanf("K14sk9stf",&client.1lastName, Bclient.firstNane, Sclient.balance); printf("Xs"."\n Enter account number:"): scanf("d",Bc1ient.accun); printf( "s\t*s\txf".client.lastName,client.firstName,client.balance): return 6;
Expert Solution
steps

Step by step

Solved in 2 steps

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY