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[1]); }

A) r
B) f
C) m
D) y

Showing Answers 1 - 7 of 7 Answers

abhimanipal

  • Jul 30th, 2009
 

When we write argv[1] its the address of 1st character of the string pointed to by argv
When we increment argv the address is of the the second string ie friday
When we write *++argv[1] its prints the 1st alphabet of the string friday

  Was this answer useful?  Yes

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