#include <stdio.h>
struct St_Test{
int t1;
int t2;
int t3;
int t4;
};
void main()
{
struct St_Test St_Test_Ex;
struct St_Test *Str_Ptr;
Str_Ptr = &St_Test_Ex;
int *p ;
p = (int*) Str_Ptr;
Str_Ptr->t1 = 11;
Str_Ptr->t2 = 22;
Str_Ptr->t3 = 33;
Str_Ptr->t4 = 44;
printf("%d\n",*(p+0));
printf("%d\n",*(p+1));
printf("%d\n",*(p+2));
printf("%d\n",*(p+3));
}
用指针指向结构体中的某一个元素的方法
猜你喜欢
转载自blog.csdn.net/qianshishangdi/article/details/82834664
今日推荐
周排行