#include <stdio.h>
struct AAA{
int a;
int b;
int c;
char d;
};
int main(){
struct AAA *t;
int buf[1024];
int i,j;
memset( buf, 0, 1024);
for(i =0; i< 1024; i++ ) buf[i]= i;
printf("t size=%d pt=%d\n", sizeof( struct AAA*), sizeof( struct AAA) );
printf("sizeof t=%d\n", sizeof(t));
printf("buf=%p\n", buf);
printf("t=%p\n", &t);
printf("t0=%p \n", &t[0]);
printf("t1=%p\n", &t[1]);
t = &buf;
//t[0] = &t+ sizeof( struct AAA*);
printf("\n\n t=%p->%p buf=%p\n", &t, t, &buf);
printf("t+=%p\n", (void*)(t+3) );
printf("t0=%p t[0]=%d\n", &t[0], t[0].a);
printf("t1=%p t[1]=%d\n", &t[1], t[1].b);
printf("t2=%p t[2]=%d\n", &t[2], t[2].a);
}
~
沒有留言:
張貼留言