该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
#include
#include
struct abc
{
unsigned int num;
char c;
};
typedef abc* pabc;
void main()
{
clrscr();
printf("a string is: dos=(H)646F73=(B)01100100 01101111 01110011 \n");
unsigned char *str="dos";
printf("\n");
printf("struct abc definition is: \n");
printf("struct abc \n");
printf("{ \n");
printf(" unsigned int num; \n");
printf(" char c; \n");
printf("} \n");
printf("\n");
printf("convert string to struct... \n");
pabc PABC=(pabc)str;
printf("%-10s%-10s \n","abc.num","abc.c");
printf("%-10d%-10c \n",PABC->num,PABC->c);
printf("\n");
printf("the string address is: %d \n",str);
printf("\n");
printf("the struct's elements address is: \n");
printf("%-10s%-10s \n","&abc.num","&abc.c");
printf("%-10d%-10d \n",&((*PABC).num),&((*PABC).c));
getchar();
return;
}
说明:
PABC->num: 28516
PABC->c: s
为什么PABC->num的数值为28516�