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"
/* 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;
}
*.c
"*.c"
sample *.c
List of all files and folders in the current directory
Answer: Option
Explanation:
No answer description is available. Let's discuss.
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:

Your comments will be displayed after verification.