#include<stdio.h>
#include<stdlib.h>
//#define long int
void testpp();
void main()
{
testpp();
}
//一级指针转二级指针
//无中间变量
void testpp()
{
long *a,*tmp;
a=(long*)malloc(sizeof(long)*2);
*a=(long)malloc(sizeof(long)*6);
*(a+1)=2;
#if 0
*((long*)a[0]+1)=5;
printf("*((long*)a[0]+1)=%ld\n",*((long*)a[0]+1));
#endif
*((long *)*a+0)=1;
*((long *)*a+1)=2;
*((long *)*a+2)=4;
*((long *)*a+3)=8;
*((long *)*a+4)=12;
printf("*(a+1)=%ld\n",*(a+1));
printf("*((long*)*a+0)=%ld\n",*((long*)*a+0));
printf("*((long*)*a+1)=%ld\n",*((long*)*a+1));
printf("*((long*)*a+2)=%ld\n",*((long*)*a+2));
printf("*((long*)*a+3)=%ld\n",*((long*)*a+3));
printf("*((long*)*a+4)=%ld\n",*((long*)*a+4));
free((long *)*a);
free(a);
}
搞定,结帖掉了。