Wednesday, November 13, 2013

Six ways to access the start address of a two-dimensional array in C


#include <stdio.h>
#include <stdlib.h>
int d[2][2]={1,2,3,4};
int main(){
  printf("%x\n",(unsigned int)d);
  printf("%x\n",(unsigned int)&d);
  printf("%x\n",(unsigned int)&d[0]);
  printf("%x\n",(unsigned int)&d[0][0]);
  printf("%x\n",(unsigned int)d[0]);
  printf("%x\n",(unsigned int)*d);
  return 0;
}

0 comments: