C Programming - Command Line Arguments - Discussion
Discussion Forum : Command Line Arguments - Find Output of Program (Q.No. 6)
6.
What will be the output of the program (sample.c) given below if it is executed from the command line?
cmd> sample "*.c"
cmd> sample "*.c"
/* sample.c */
#include<stdio.h>
int main(int argc, int *argv)
{
int i;
for(i=1; i<argc; i++)
printf("%s\n", argv[i]);
return 0;
}
Discussion:
22 comments Page 3 of 3.
Prashant Kumar said:
8 years ago
I am getting the output as list of all .c file in the current directory? why it's so?
Tanya said:
7 years ago
Please explain the correct answer.
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers