Question: / / Compile with: gcc - no - pie - g - Wl , - z , norelro - fno - stack - protector -
Compile with: gcc nopie g Wlznorelro fnostackprotector UFORTIFYSOURCE o heap heapc #include #include #include #define NAMELENGTH #define INPUTLENGTH int mainint argc, char argv char inputINPUTLENGTHpresvpjan; int choice; while choice printf MENU
; printf Allocate memory for president's name.
; printf Input president's name.
; printf Display president's name.
; printf Free memory for president's name.
; printf Allocate memory for vice president's name.
; printf Input vice president's name.
; printf Display vice president's name.
; printf Free memory for vice president's name.
; printf Allocate memory for janitor's name.
; printf Input janitor's name.
; printf Display janitor's name.
; printf Free memory for janitor's name.
; printf QUIT
; fgetsinput INPUTLENGTH stdin; choiceatoiinput; switch choice case : presmallocNAMELENGTH; break; case : printfEnter president's name: ; fflushstdin; fgetspres NAMELENGTH stdin; break; case : printfPresidents name: s
pres; break; case : freepres; break; case : vpmallocNAMELENGTH; break; case : printfEnter vice president's name: ; fflushstdin; fgetsvp NAMELENGTH stdin; break; case : printfVice president's name: s
vp; break; case : freevp; break; case : janmallocNAMELENGTH; break; case : printfEnter janitor's name: ; fflushstdin; fgetsjan NAMELENGTH stdin; break; case : printfJanitors name: s
jan; break; case : freejan; break; printfBYE
; return ;
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
