RE: If the program (myprog) is run from the command line as myprog 1 2 3 , What would be the output? main(int argc, char *argv[]) { int i; for(i=0;i<argc;i++) printf("%s",argv[i]); }
None of the above. It should be : myprog123. Because argv[0] "myprog" argv[1] "1" argv[2] "2" argv[3] "3".
RE: If the program (myprog) is run from the command line as myprog 1 2 3 , What would be the output? main(int argc, char *argv[]) { int i; for(i=0;i<argc;i++) printf("%s",argv[i]); }
the result will be
c:mypgm.exe123
becoz argv[0] will be the location of ur program(be it c: or d:)
RE: If the program (myprog) is run from the command line as myprog 1 2 3 , What would be the output? main(int argc, char *argv[]) { int i; for(i=0;i<argc;i++) printf("%s",argv[i]); }
The answer is b. because command line argument includes file path as first argument.