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]
Discussion:
70 comments Page 3 of 7.
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)
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)
Kuttu said:
1 decade ago
Thanks anil kumar.
Bhuvana said:
1 decade ago
Thanks ramanji.
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
}
}
}
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
}
}
}
Meenu said:
1 decade ago
Explain this concept.
Sagar said:
1 decade ago
Thanks pradeep
Rajesh said:
1 decade ago
Nice Explanation by ramaji & pradeep.
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.
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.
Ravitheja said:
1 decade ago
Anil Kumar Kandula.
Thank you very much. Nice eplanation.
Thank you very much. Nice eplanation.
Rishabh said:
1 decade ago
An another way to represent pointer as array is ?
ptr[0]------>*(ptr+0);
ptr[1]------>*(ptr+1);
ptr[0]------>*(ptr+0);
ptr[1]------>*(ptr+1);
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers