#include <stdio.h>
#include <stdlib.h>
typedef char array[20];
typedef struct BiTNode{
int data;
struct BiTNode *lchild,*rchild;
}BiTNode,*BiTree;
int main() {
array a;
BiTree f = (BiTNode*)malloc(sizeof(BiTNode));
BiTree *p = &f;
printf("f的值为:%p,\nf的地址为:%p,\np的值为:%p,\n*p的值为:%p\n",f,&f,p,*p);
printf("a数组中的每个元素占用空间的大小为:%d\n",sizeof(a[10]));
printf("a数组总体占用空间大小为:%d\n",sizeof(a));
return 0;
}
程序运行结果:
f的值为:00B215A8,
f的地址为:0061FEB4,
p的值为:0061FEB4,
*p的值为:00B215A8
a数组中的每个元素占用空间的大小为:1
a数组总体占用空间大小为:20
typedef char array[20]相当于定义了一个含有20个char类型的元素数组,并将这个数组取了个别名为array,那么array a相当于char a[20];
typedef struct BiTNode{
int data;
struct BiTNode *lchild,*rchild;
}*BiTree;
相当于定义了BiTNode* 类型的指针别名为BiTree,那么BiTree f相当于BiTNode* f,BiTree *p相当于BiTNode **p