#include<stdio.h>
int main(void)
{
//第一种 结构体指针
// struct ucode
// {
// char u1;
// int u2;
// };
// struct ucode a={'a',98};
// struct ucode *p=&a;
//第二种
// struct ucode
// {
// char u1;
// int u2;
// }a={'a',98},*p=&a;
// struct ucode a={'a',98};
// struct ucode *p=&a;
// printf("p->u1=%c,p->u2=%d\n",(*p).u1,(*p).u2);//(*p).u1与 p->u1等价,表达相同的意思
//第三种
typedef struct
{
char u1;
int u2;
}ucode;
ucode a={'a',98};
ucode *p=&a;
printf("p->u1=%c,p->u2=%d\n",p->u1,p->u2);
} |