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.
Rohit Kumar said:
7 years ago
Here, convert all the options in postfix expression and read, the correct option will char *ptr[3];.
Tamil said:
1 decade ago
Yes. You are right. Ptr is the array which contains 3 character pointer.
Raju said:
1 decade ago
char *ptr[3] is correct. There is 3 characters are defined in pointers.
Indu mounika said:
1 decade ago
ptr[3] shows an element of an aray.
So *ptr[3] is a valid pointer
So *ptr[3] is a valid pointer
Naitik gupta said:
1 decade ago
I agree the the pointer hold variable like these char(*ptr[3]);
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.
Vishal sanghani said:
8 years ago
char *ptr[3] is the right one.
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