Ken H

Ken H

  • NA
  • 646
  • 361.2k

Two-dimensional array of pointers pointing in c

Sep 28 2013 11:55 PM
hi,
   When I try to indirect reference error occurred while two-dimensional array.
 
My codes are here:
 #include<stdio.h>
void main(void)
{
   int arrTwo[2][2]={{1,2},{3,4}},*pointer_one,**pointer_two;
   pointer_one=arrTwo;
   pointer_two=pointer_one; // Try an indirect reference to two-dimensional array.
  for (int i=0;i<2;i++)
  {
    for (int j=0;j<2;j++)
       printf("%d ",*([pointer_two+i]+j));
     
     printf("\n");
  }

}



Answers (3)