C Programming - Command Line Arguments - Discussion

Discussion Forum : Command Line Arguments - Point Out Correct Statements (Q.No. 1)
1.
Which of the following is TRUE about argv?
It is an array of character pointers
It is a pointer to an array of character pointers
It is an array of strings
None of above
Answer: Option
Explanation:
No answer description is available. Let's discuss.
Discussion:
5 comments Page 1 of 1.

Mangusta said:   1 decade ago
The answer is not B, because declaration of pointer to array of character pointers will look like:

char * (*argv)[some size];

Inside of main, "argv" is a pointer to a pointer to character,
or in other words, a pointer to string, it is more than just "array", because we can perform arithmetic operations on it.

For example, ++argv or --argv are legal statements for argv.

Shweta Dubey said:   1 decade ago
The answer of this question is B, as argv is a pointer to an array of pointer to strings.It is used as double pointer in the argument of main() mean it is a pointer to a pointer.

Usha said:   1 decade ago
Hey option A is right yar because *argv[] means argv[] behaves like a array of character so *argv[] = it is an array of character pointer.

Raj Naik said:   1 decade ago
@shweta @vikas: yeah you both are right.

Vikas said:   1 decade ago
@shweta yes you are right.

Post your comments here:

Your comments will be displayed after verification.