If the following program (myprog) is run from the command line as myprog friday tuesday sunday,  What would be the output? main(int argc, char*argv[]) { printf("%c",**++argv); }

A)

m


B) f
C) myprog
D) friday

Showing Answers 1 - 4 of 4 Answers

abhimanipal

  • Jul 29th, 2009
 

printf("%d",argv);
this prints the address of the first argument

printf("%s",*argv);
this prints the first argument myprog

printf("%c",**++argv);
this prints the first character of the first argument

Now if we use an increment operator before all this we get f as the final o/p.

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions