C Programming - Pointers - Discussion
Discussion Forum : Pointers - True / False Questions (Q.No. 4)
4.
Are the three declarations char **apple, char *apple[], and char apple[][] same?
Discussion:
43 comments Page 4 of 5.
Vinay said:
1 decade ago
No
a[i][j]=*(*(a+i)+j)
a[i][j]=*(*(a+i)+j)
Laxmi said:
1 decade ago
2 is pointer array & 1,3 are same.
Minakshi Jain said:
1 decade ago
Yes, I agree with laxmi.
Pooja said:
2 decades ago
char **apple - It is a double pointer
char *apple[] -It is an array of pointers
char apple[][]-It id 2-d array.
char *apple[] -It is an array of pointers
char apple[][]-It id 2-d array.
Prakash g said:
1 decade ago
Yes I agree with Vikash.
Abc said:
1 decade ago
Array of pointers means array consist of pointers.
Pointers of array means just pointer pointing to array.
Pointers of array means just pointer pointing to array.
Ashutosh said:
1 decade ago
This is a true statement. You can check with compiler.
Nabin kumar said:
1 decade ago
I agree with Ashutosh.
Dev Dixit said:
1 decade ago
**a
or
*a[]
or
**a[]
are the same statement.
Eg: we can write
a[1][1][1] as *(*(*(a+1)+1)+1).
or
*a[]
or
**a[]
are the same statement.
Eg: we can write
a[1][1][1] as *(*(*(a+1)+1)+1).
Ram said:
1 decade ago
*a --> *a+0 --> a[0] (not a[])
**a --> **a+0 -->*(*a+0) --> *(a[0]) -->* a[0] +0 --> a[0][0]
llly
***a ---> a[0][0][0]
(not a[][][])
**a --> **a+0 -->*(*a+0) --> *(a[0]) -->* a[0] +0 --> a[0][0]
llly
***a ---> a[0][0][0]
(not a[][][])
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers