Tuesday, February 21, 2012

What would be the equivalent pointer expression for referring the array element a[i][j][k][l] ?

Ans :


a[i][j][k][l] can be represented as   *(*(*(*(a+i)+j)+k)+l)

3 comments:

  1. can you please expain the solution

    ReplyDelete
  2. a[i] == *(a+i)
    a[i][j] == *(*(a+i)+j)
    a[i][j][k] == *(*(*(a+i)+j)+k)
    a[i][j][k][l] == *(*(*(*(a+i)+j)+k)+l)

    ReplyDelete