C Programming - Command Line Arguments - Discussion
Discussion Forum : Command Line Arguments - Find Output of Program (Q.No. 16)
16.
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
cmd> sample 1 2 3
cmd> sample 2 2 3
cmd> sample 3 2 3
/* sample.c */
#include<stdio.h>
int main(int argc, char *argv[])
{
printf("%s\n", argv[0]);
return 0;
}
Discussion:
14 comments Page 2 of 2.
Rahul said:
8 years ago
Is the previous sample being overwritten by the next one?
Anshi said:
1 decade ago
Please. If some one know it then explain it.
Shivu said:
1 decade ago
Please tell me why sample 123 wrong.
Aman said:
1 decade ago
Can any one explane please?
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers