#include "pch.h"
#include <iostream>
using namespace std;
struct s
{
int a;
};
int main()
{
struct s t1;
struct s *t2;
t2 = &t1;
t1.a = 10;
printf("%d\n", t1.a);
printf("%d\n", (&t1)->a);
printf("%d\n", t2->a);
printf("%d\n", (*t2).a);
return 0;
}
结构体访问成员的4种方式
最新推荐文章于 2024-04-21 00:57:49 发布