C Programming - Command Line Arguments - Discussion

1. 

Which of the following is TRUE about argv?

[A]. It is an array of character pointers
[B]. It is a pointer to an array of character pointers
[C]. It is an array of strings
[D]. None of above

Answer: Option A

Explanation:

No answer description available for this question.

Shweta Dubey said: (Oct 24, 2010)  
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.

Vikas said: (Feb 25, 2011)  
@shweta yes you are right.

Raj Naik said: (Aug 25, 2011)  
@shweta @vikas: yeah you both are right.

Usha said: (May 18, 2013)  
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.

Mangusta said: (Aug 21, 2013)  
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.

Post your comments here:

Name *:

Email   : (optional)

» Your comments will be displayed only after manual approval.