C Programming - Complicated Declarations - Discussion
Discussion Forum : Complicated Declarations - General Questions (Q.No. 1)
1.
Declare the following statement?
"An array of three pointers to chars".
"An array of three pointers to chars".
Discussion:
19 comments Page 2 of 2.
Dhiraj said:
1 decade ago
What you have marked as answer is a pointer to an array of three character the correct answer will be char (*ptr)[3];
Raju said:
1 decade ago
char *ptr[3] is correct. There is 3 characters are defined in pointers.
Kavinder singh said:
1 decade ago
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
*(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
Richa Rao said:
1 decade ago
It must be *ptr[2] as index start from 0th position.
Raj said:
1 decade ago
Option b is absolutely correct no discussion at all.
Nishu nishant said:
1 decade ago
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..
*(ptr[3])is a pointer to array of 3 elements
where as *ptr[3] is an array consists of 3 pointers.
agreed with nagraj..
Nagaraj said:
1 decade ago
char *ptr[3]; It is an array wich consists of pointers.
int *(ptr[20]); It is the pointer to array of 10 elements
int *(ptr[20]); It is the pointer to array of 10 elements
Tamil said:
1 decade ago
Yes. You are right. Ptr is the array which contains 3 character pointer.
Bhavani said:
1 decade ago
Yes (*ptr)[3] is correct.
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers