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.
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[][][])
RAYA said:
9 years ago
char **apple -----------> This is Double Pointer.
char *apple[] -----------> This is Array Pointer.
char apple[][] -----------> This is 2D Array.
char *apple[] -----------> This is Array Pointer.
char apple[][] -----------> This is 2D Array.
Ashwini said:
1 decade ago
char **apple - double pointer.
char *apple[] - array of pointers.
char apple[][] - 2D array.
char (*apple)[5] - pointer to an array of 5 characters.
char *apple[] - array of pointers.
char apple[][] - 2D array.
char (*apple)[5] - pointer to an array of 5 characters.
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
Shusec said:
7 years ago
1 -----> apple[1] = *(apple +1).
2 -----> apple[1][1]= *(*(apple+1)+1).
3 -----> from 1 and 2 apple[1][1] = *(apple[1] +1).
2 -----> apple[1][1]= *(*(apple+1)+1).
3 -----> from 1 and 2 apple[1][1] = *(apple[1] +1).
Larry said:
9 years ago
1 -----> apple[1] = *(apple +1).
2 -----> apple[1][1]= *(*(apple+1)+1).
3 -----> from 1 and 2 apple[1][1] = *(apple[1] +1).
2 -----> apple[1][1]= *(*(apple+1)+1).
3 -----> from 1 and 2 apple[1][1] = *(apple[1] +1).
BDS said:
1 decade ago
char **apple ------>Its a double Pointer.
char *apple[] -------->Array of Pointers.
char apple[][] ---------->2D Array.
char *apple[] -------->Array of Pointers.
char apple[][] ---------->2D Array.
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.
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.
Anu said:
1 decade ago
Yes I agree with Vikash.
For eg:
if a[i][j]=*(*(a+i)) then apple[][]=*(apple[])=*(*apple)) i think ..
For eg:
if a[i][j]=*(*(a+i)) then apple[][]=*(apple[])=*(*apple)) i think ..
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers