C Programming :: Command Line Arguments
-
What will be the output of the program (sample.c) given below if it is executed from the command line?
cmd> sample monday tuesday wednesday thursday/* sample.c */ #include
int main(int argc, char *argv[]) { while(--argc>0) printf("%s", *++argv); return 0; } -
If the following program (myproc.c) is present in the directory "C:\TC" then what will be output of the program if run it from DOS shell?
/* myproc.c */ #include
int main(int argc, char *argv[]) { printf("%s", argv[0]); return 0; } -
What will be the output of the program (myprog.c) given below if it is executed from the command line?
cmd> myprog one two three/* myprog.c */ #include
int main(int argc, char *argv[]) { int i; for(i=1; i "%c", argv[i][0]); return 0; } -
What will be the output of the program (sample.c) given below if it is executed from the command line?
cmd> sample 1 2 3
cmd> sample 2 2 3
cmd> sample 3 2 3/* sample.c */ #include
int main(int argc, char *argv[]) { printf("%s\n", argv[0]); return 0; } -
What will be the output of the program (myprog.c) given below if it is executed from the command line?
cmd> myprog 1 2 3/* myprog.c */ #include
#include "%d\n", j); return 0; } -
What will be the output of the program (sample.c) given below if it is executed from the command line?
cmd> sample friday tuesday sunday/* sample.c */ #include
int main(int sizeofargv, char *argv[]) { while(sizeofargv) printf("%s", argv[--sizeofargv]); return 0; } -
What will be the output of the program (sample.c) given below if it is executed from the command line?
cmd> sample friday tuesday sunday/* sample.c */ #include
int main(int argc, char *argv[]) { printf("%c", *++argv[2] ); return 0; } -
What will be the output of the program (myprog.c) given below if it is executed from the command line?
cmd> myprog one two three/* myprog.c */ #include
#include int main(int argc, char **argv) { int i; for(i=1; i3; i++) printf("%u\n", &argv[i]); return 0; }If the first value printed by the above program is 65517, what will be the rest of output?