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 1 of 2.

Jetha lal tapuu ke papa said:   3 years ago
I think option A is the right answer.
(1)

Tripathi said:   7 years ago
Ans: argc (ARGument Count) is int and stores number of command-line arguments passed by the user including the name of the program. So if we pass a value to a program, value of argc would be 2 (one for argument and one for program name).

The value of argc should be non negative.

Argv (ARGument Vector) is array of character pointers listing all the arguments.

If argc is greater than zero, the array elements from argv[0] to argv[argc-1] will contain pointers to strings.

Argv[0] is the name of the program, After that till argv[argc-1] every element is command -line arguments.
(1)

Anomii said:   7 years ago
Answer is true as its the count.

Soundar said:   9 years ago
Ans: FALSE, read the question again carefully (must always be count of total arguments) it says we should give the count ie the total number of argument we are going to use. Argc stores only the number of argument given during the run time.

D.mehul said:   9 years ago
The argument supplied in command line not main();.

The, the answer is false.

Aman said:   9 years ago
No, the correct answer is false.

Sneha said:   9 years ago
The argc parameter is the count of total command line arguments passed to the executable on execution (including the name of the executable as the first argument).

So the answer is true.

Rohan said:   1 decade ago
@Swetha yeah correctly said me too was mistaken by the language used.

The question asked is "First argument to be supplied at command-line". They are asking If we need supply any such argument. So it's clearly false.

Swetha Madhuri said:   1 decade ago
Hey guys the answer is false.

Because the question asked is first argument in command line not to main().

Hope you understand. :).

Seema said:   1 decade ago
1st argument is always program name.


Post your comments here:

Your comments will be displayed after verification.