在C动变量声明 [英] Dynamic variable declaration in C
本文介绍了在C动变量声明的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我是一个Ruby开发者和被长久以来我一直C. codeD我有这个小问题-Basically我想用用C其行为类似于C的符号的数据类型。
I'm a ruby developer and its been long since I've coded in C. I have this small issue -Basically I want to use a datatype in C which behaves like a symbol in C.
在换句话说,这是可能用C?
In other words, is this possible in C?
- 程序将要求用户输入名称
- 用户回复 - foobar的
-
声明具有相同的名称即一个整数。
- Program asks user for name
- user replies - "foobar"
declare an integer with the same name i.e.
INT foobar的
int foobar
感谢
推荐答案
不像间preTED语言,对C在运行时不变量名的字典。存在在运行时没有变量名都没有。因此,遗憾的是它是不可能做到在C想要的东西。
Unlike in interpreted languages, C does not have a dictionary of variable names at runtime. There exist no variable names at runtime at all. Hence unfortunately it is impossible to do what you want in C.
这篇关于在C动变量声明的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文