指针相减问题
#include<stdio.h>#include<stdlib.h>
void main()
{
int *p,*q;
p=(int *)malloc(sizeof(int *));
q=(int *)malloc(sizeof(int *));
printf("%d\n",q);
printf("%d\n",p);
printf("%d-%d=%d\n",p,q,p-q);
}
编译结果却是
4391168
4391216
4391216-4391168=12