C Programming - Pointers - Discussion

Discussion Forum : Pointers - General Questions (Q.No. 6)
6.
What would be the equivalent pointer expression for referring the array element a[i][j][k][l]
((((a+i)+j)+k)+l)
*(*(*(*(a+i)+j)+k)+l)
(((a+i)+j)+k+l)
((a+i)+j+k+l)
Answer: Option
Explanation:
No answer description is available. Let's discuss.
Discussion:
70 comments Page 5 of 7.

Rishabh said:   1 decade ago
An another way to represent pointer as array is ?

ptr[0]------>*(ptr+0);
ptr[1]------>*(ptr+1);

Ravitheja said:   1 decade ago
Anil Kumar Kandula.

Thank you very much. Nice eplanation.

Raju Naidu said:   1 decade ago
Arrays internally works based on pointers. In arrays each subscript represents one pointer.

Ex:a[1]

Once you compile this code it internally converted into
*(a+1)or*(1+a)

That's y
a[i][j][k][l]---->a[i]--->*(a+i)(one subscript means onepointer)
a[i][j]--->*(*(a+i)+j)(Two subscripts means two pointers)
a[i][j][k]----->*(*(*(a+i)+j)+k)
a[i][j][k][l]---->*(*(*(*(a+i)+j)+k)+l)

Bye friends.

Rajesh said:   1 decade ago
Nice Explanation by ramaji & pradeep.

Sagar said:   1 decade ago
Thanks pradeep

Meenu said:   1 decade ago
Explain this concept.

Ashok said:   1 decade ago
Given: a[i][j][k][l]

i number of rows with
{
each contains j number of rows with
{
each contains k number of rows with
{
EACH CONTAINS l no of columns
}
}
}

Bhuvana said:   1 decade ago
Thanks ramanji.

Kuttu said:   1 decade ago
Thanks anil kumar.

Anil kumar Kandula said:   1 decade ago
a[i] = *(a+i)

a[i][j] = *(a[i]+j)
= *(*(a+i)+j)

a[i][j][k]= *(a[i][j]+k)
= *(*(a[i]+j)+k)
= *(*(*(a+i)+j)+k)


Post your comments here:

Your comments will be displayed after verification.