gpt4 book ai didi

c - 像 "typedef int arrChoice[5];"这样的东西是全局变量吗?

转载 作者:行者123 更新时间:2023-11-30 15:55:43 25 4
gpt4 key购买 nike

#include <stdio.h>
#include <conio.h>
typedef arrChoice[10] /*is this a global variable?*/
int main() {};

getch();
return 0;
}

还没完成,但这就是我的意思。

最佳答案

typedef 不是全局变量,它只是另一种类型的别名。当我传递函数指针时,我通常将它们用作函数指针,因为每次都将它们写出来很烦人。

typedef int (*function)(int, int);

我还使用它们将结构、 union 或枚举定义为类型

typedef struct {
int x;
int y;
int z;
} Point;

关于c - 像 "typedef int arrChoice[5];"这样的东西是全局变量吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11838984/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com