S
smartbeginner
I got from a book a 2D array(a[j] is resolved by compiler as
a[j]=*(&a[0][0]+total_columns*i+j); // ->1
[Stephen Holzners Assembly Language with C]
And I know when I use pointer to array I should refer
a[j]=*(*(a+i)+j); ->2
Is this also resolved by the compiler to (->1) (Awkward question I
know)
And my main question is why we use *(a+i) here
In the pointer to array notation
a[j]=*(a+j);
& this again resolves to
a[j]=*(*(a+i)+j);
which is same as (2)
Then whats the need of both array of pointers and pointer to array
Is this makes compilers work easy
a[j]=*(&a[0][0]+total_columns*i+j); // ->1
[Stephen Holzners Assembly Language with C]
And I know when I use pointer to array I should refer
a[j]=*(*(a+i)+j); ->2
Is this also resolved by the compiler to (->1) (Awkward question I
know)
And my main question is why we use *(a+i) here
In the pointer to array notation
a[j]=*(a+j);
& this again resolves to
a[j]=*(*(a+i)+j);
which is same as (2)
Then whats the need of both array of pointers and pointer to array
Is this makes compilers work easy