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 3 of 5.
Susil said:
1 decade ago
Ya pooja and Mrutyunjay are correct.
Sneha said:
1 decade ago
YES I do agree with RAM
Mrutyunjay said:
1 decade ago
char **apple - Pointer to pointer to a character
char *apple[] - An array of pointer to a character
char apple[][]- It is 2 dimensional array
char *apple[] - An array of pointer to a character
char apple[][]- It is 2 dimensional array
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.
Sanat said:
1 decade ago
The functionality are same.It simply uses different terms.
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[][][])
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).
Nabin kumar said:
1 decade ago
I agree with Ashutosh.
Ashutosh said:
1 decade ago
This is a true statement. You can check with compiler.
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.
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers