C Programming - Command Line Arguments - Discussion
Discussion Forum : Command Line Arguments - Find Output of Program (Q.No. 20)
20.
What will be the output of the program (myprog.c) given below if it is executed from the command line?
cmd> myprog 10 20 30
cmd> myprog 10 20 30
/* myprog.c */
#include<stdio.h>
int main(int argc, char **argv)
{
int i;
for(i=0; i<argc; i++)
printf("%s\n", argv[i]);
return 0;
}
Discussion:
14 comments Page 2 of 2.
Abhirup said:
1 decade ago
Can some one elaborate this answer? Not getting why 30 is printed?
Puneet kaushik said:
1 decade ago
Please explain this question in detail. I haven't understood yet.
Vijeta said:
1 decade ago
Hey Rabi can you explain it in detail, I haven't understood.
Devesh agarwal said:
1 decade ago
Does any have the explanation for this ?
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers