Question: Run the program below with 4 command line arguments of your own choosing, at least one of which is a flag and one of which

Run the program below with 4 command line arguments of your own choosing, at least one of which is a flag and one of which is a non-flag argument. The program displays arex, addresses
a. Record the command line that you used
b. From the program output, report the base address (the starting address) of argy and range of addresses used store the command line.
Purpose: shows the arguments on the cod line ie: showArgs one two three *c
#include stdio ba #include sunistd.h #include < stdlibh
int main(int arge, char* argxll.char * enxplI
fprintfistdout, "My name is %s. I'm process #%d."
"I have "d cod line argsinin". argx[01 getRidO.arge):
/Showing the command line aras
for(int 1=0 argvElatt)
fprintf{stdout,"%p.%s [%p]n"
&argxlil. arexfil, arell:
fprintistdout, "Look at what's at location arglargs]: location: "p value: "pIn".
dargxIaras] arexlargs]):
system("bash"):
create a subshell to look at /proc/pid/codline
fprintf(stdout, "We're back n"): fprintf(stdout."
Just in time to leave!!! n"):
return 0:
}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!