C Programming - Command Line Arguments - Discussion
Discussion Forum : Command Line Arguments - Find Output of Program (Q.No. 2)
2.
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
cmd> myprog one two three
/* myprog.c */
#include<stdio.h>
#include<stdlib.h>
int main(int argc, char **argv)
{
printf("%s\n", *++argv);
return 0;
}
Discussion:
15 comments Page 2 of 2.
Vidi said:
1 decade ago
Can anyone elaborate on : char **argv[] used.
Priya said:
1 decade ago
Why is the argc mentioned here unnecessarily?
Ankur said:
1 decade ago
Can someone explain this output in detail ?
Abhinav Kumar said:
9 years ago
**++argv should be used instead of *++argv.
Anshu said:
7 years ago
Good explanation, Thanks @Sholvi.
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers