C Programming - Complicated Declarations - Discussion
Read more: "Everything should be made as simple as possible, but not simpler."
- Albert Einstein
1.
Declare the following statement?
"An array of three pointers to chars".
[A].
char *ptr[3]();[B].
char *ptr[3];[C].
char (*ptr[3])();[D].
char **ptr[3];
Answer: Option B
Explanation:
No answer description available for this question.
Dhiraj said:
(Wed, Sep 22, 2010 12:00:15 AM)
What you have marked as answer is a pointer to an array of three character the correct answer will be char (*ptr)[3];
Bhavani said:
(Thu, Dec 2, 2010 02:01:52 PM)
Yes (*ptr)[3] is correct.
Tamil said:
(Sun, Dec 19, 2010 10:37:30 AM)
Yes. You are right. Ptr is the array which contains 3 character pointer.
Nagaraj said:
(Thu, Dec 30, 2010 05:29:28 AM)
char *ptr[3]; It is an array wich consists of pointers.
int *(ptr[20]); It is the pointer to array of 10 elements
Nishu Nishant said:
(Fri, Dec 31, 2010 06:03:50 AM)
yes b option is correct *ptr[3]
*(ptr[3])is a pointer to array of 3 elements
where as *ptr[3] is an array consists of 3 pointers.
agreed with nagraj..
Raj said:
(Wed, Jun 1, 2011 10:10:18 AM)
Option b is absolutely correct no discussion at all.
Richa Rao said:
(Sun, Jul 10, 2011 01:11:29 AM)
It must be *ptr[2] as index start from 0th position.
Kavinder Singh said:
(Tue, Sep 20, 2011 11:17:44 AM)
Yes b option is correct *ptr[3]
*(ptr[3])is a pointer to array of 3 elements
where as *ptr[3] is an array consists of 3 pointers.
agreed with nagraj and nishu
Raju said:
(Thu, Feb 9, 2012 04:35:08 PM)
char *ptr[3] is correct. There is 3 characters are defined in pointers.