C++歪门邪道
# 将结构体typedef为数组
https://blog.csdn.net/qq_44844115/article/details/106099244
typedef struct _s
{
int a = 0;
}s[1];
void func(s input)
{
input->a++;
}
int main()
{
s tmp; // 相当于 _s tmp[1]
func(tmp);
cout << tmp->a << endl; // print: 1
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
编辑 (opens new window)
上次更新: 2023/05/07, 17:27:54