C语言程序:查看变量数据类型 (name, age, height)
您可以使用以下代码来实现您的要求:
#include <stdio.h>
int main() {
char name[] = '测试';
int age = 20;
float height = 1.75;
printf('%s\n', typeof(name));
printf('%s\n', typeof(age));
printf('%s\n', typeof(height));
return 0;
}
请注意,C语言中没有内置的 typeof 函数来获取变量的类型。上述代码中使用了 printf 函数来打印变量的类型。
原文地址: https://www.cveoy.top/t/topic/eIMz 著作权归作者所有。请勿转载和采集!