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 2 of 5.
Minakshi Jain said:
1 decade ago
Yes, I agree with laxmi.
Pratik Patel said:
1 decade ago
Hey can you tell me whats diff bet array of pointer and pointer of array?
Please reply.
Please reply.
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[][][])
Sanat said:
1 decade ago
The functionality are same.It simply uses different terms.
Rupinderjit said:
1 decade ago
#1:t's pointer to pointer to variable,that is,it points to another pointer which further points to variable apple's address.
#2:It's array of pointers(uninitialized),usually used to hold number of strings,that is,it is pointer to array of strings.
#3:It is simply array declaration and variable name array is pointer to first element of itself.
#2:It's array of pointers(uninitialized),usually used to hold number of strings,that is,it is pointer to array of strings.
#3:It is simply array declaration and variable name array is pointer to first element of itself.
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers