[1]
#include "stdafx.h"
#include "stdio.h"
#include "stdlib.h"
int main(int argc, char* argv[])
{
char* data = "12345678";
short* tmp = NULL;
char p[6] = {0};
tmp = (short *)&p[2];
*tmp = atoi(&data[4]);
//p[0] = ?, p[1] = ?, p[2] = ?, p[3] = ?, p[4] = ?, p[5] = ?。
printf("p0 = %d\n", p[0]);
printf("p1 = %d\n", p[1]);
printf("p2 = %d\n", p[2]);
printf("p3 = %d\n", p[3]);
printf("p4 = %d\n", p[4]);
printf("p5 = %d\n", p[5]);
return 0;
}
[2]
#include "stdafx.h"
#include "stdio.h"
#include "stdlib.h"
struct A
{
int i;
int *p;
};
int main(int argc, char* argv[])
{
A a;
int *pr = &a.i;
pr[0] = 3;
pr[1] = 4;
printf(" a.i = %d\n a.p = %p\n &a.p = %p\n",a.i, a.p, &a.p);
a.p = pr;
a.p[0] = 5;
a.p[1] = 6;
*a.p = 7;
printf(" a.i = %d\n a.p = %p\n *a.p = %d\n &a.p = %p\n", a.i, a.p, *a.p, &a.p);
return 0;
}