C Programming - Command Line Arguments - Discussion
Discussion Forum : Command Line Arguments - Find Output of Program (Q.No. 4)
4.
What will be the output of the program (sample.c) given below if it is executed from the command line (turbo c under DOS)?
cmd> sample Good Morning
cmd> sample Good Morning
/* sample.c */
#include<stdio.h>
int main(int argc, char *argv[])
{
printf("%d %s", argc, argv[1]);
return 0;
}
Discussion:
17 comments Page 2 of 2.
Naga Vikas said:
1 decade ago
Does this depends on the compilers? Because I get it as 4 Sample.
0--Path.
1--Sample.
2--Good.
3--Morning.
Anyone please tell me?
0--Path.
1--Sample.
2--Good.
3--Morning.
Anyone please tell me?
(3)
Vijay said:
1 decade ago
Can any one explain how actually memory allocation is done in command line argument.
Datts said:
7 years ago
After a first value insertion count is automatically incremented i.e. count++.
Meera said:
5 years ago
I am not understanding this, Please anyone help me.
(1)
Vidhya Balan said:
1 decade ago
Tell me - what is command line argument?
Garima said:
8 years ago
Why it count? Please explain me.
Prash... said:
9 years ago
Thanks @Sundar.
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers