C Programming - Command Line Arguments - Discussion

Discussion Forum : Command Line Arguments - True / False Questions (Q.No. 3)
3.
The first argument to be supplied at command-line must always be count of total arguments.
True
False
Answer: Option
Explanation:
No answer description is available. Let's discuss.
Discussion:
18 comments Page 2 of 2.

SHAAN said:   1 decade ago
Answer is TRUE. The first argument to be supplied at command-line must always be count of total arguments.

Pravin Agrawal said:   1 decade ago
Answer is TRUE. Program name itself is an argument and always be the count of total arguments.I have tried it..

Rupinder said:   1 decade ago
Answer is TRUE. Program name itself is an argument and always be the count of total arguments.

Jailani said:   1 decade ago
If the program name is hello then:

int main(int argc,char *argv){
----------------
----------------
----------------
statements;
return o;
}

The output id:
cd>exc hello.c jailani sukanya tej
the value of argc is :3
and argv[0] is hello
argv[1] is jailani
and so on.

Pank said:   1 decade ago
@Sukanya please specify the prototype.

Sukanya said:   1 decade ago
Command line argument is the information followed by program's name on the command line of operating system.

Two special built in functions are present which specify the number of arguments on command line and pointer to an array of character pointers, those are argc and argv respectively.

Hence 1st argument is always program name.

Tej said:   1 decade ago
Can any explain any one please ?

Shanmugam said:   1 decade ago
The first argument is name of the program.


Post your comments here:

Your comments will be displayed after verification.