|
Blue Forest http://www.lslnet.com at 10:18 on June 6, 2006
[] C language, whether we realize string variable name, variable substitution out For instance, there
[code]
Char s[]= "abc";
Int abc = 5;
[/code]
Can the string's been variable, the value abc?
In some other language, we can achieve this function, for instance :
Vb in China
[code]
Result = Py (expression)
[/code]
Shell in China
[code]
V1=aaa
V2=bbb
P1
If $c -eq [1]
Then
Vname=v$c # find qualified variable named v1
Eval vvv= "$" $vname; echo vvv : $vvv # vvv given to the value of variables v1, so vvv=aaa
Eval vvv= '$' $vname; echo vvv : $vvv # vvv given to the value of variables v1, so vvv=aaa
#eval Vvv=$$vname; echo vvv : # wrong usage $vvv
Fi
[/code]
In dbaseIII, foxbase, foxpro :
[code]
? &s.
Or
? Eval (s)
[/code]
More languages are interpreted or pseudo-edited.
In the C language, int abc=5 actually addresses abc is a name with the string "abc" irrelevant. I guess it may be difficult to achieve bars.
Tomorrow is the beginning of 8, you have to work standing, it was a New Year dishes, helping him to discuss my views. Thank you. |
[] C language, whether we realize string variable name, variable substitution out What's main floor? ? ?
So I do not know what you mean! ! !
Is not for the value of variables exercises abc's way? ? ?
In dbaseIII, foxbase, foxpro :
? &s.
Or
? Eval (s)
Above replacement value of the variable can realize up! ! ! |
[] C language, whether we realize string variable name, variable substitution out Can be achieved in other languages, C could certainly become a reality.
But I can not, huh, huh, feel quite interesting. Why should you use?
But certainly with the guide, with the target indicator, my brain is inadequate, and does not want to understand. |
[] C language, whether we realize string variable name, variable substitution out -->
The hash table is that you have to own programming, find this book a look at the data structure will understand. Or produce code with the tools available, such as the gnu gperf. |
[] C language, whether we realize string variable name, variable substitution out -->
I mean, in addition to many outside the C language, so long as we know the names of variables, the variables can bring out value substitution.
For example, I have a string s, it is the "abc", I can's, the name has been variable abc |
[] C language, whether we realize string variable name, variable substitution out -->
You used Hashing? Is likely to use all of the addresses are of the variable into account? This workload is too heavy bars.
If I quote the address is a dynamic variable to the malloc how?
I do not know the correct understanding. Thank you |
[] C language, whether we realize string variable name, variable substitution out I think not likely to bars, according to the definition above, it seems abc variables were defined using string, c language is the language compiler (not interpretive) code compiler, pre - variable was assigned a storage space, but he must visit his visit to address this process in the first variation on the translation completed. This code compiler's space allocated char, abc's existence, the value is not as a variable name to, I think this is the case, otherwise the system is not unsafe because of the care system may change the data. |
[] C language, whether we realize string variable name, variable substitution out Do not use C language, C compiler is implemented, and you are an example to explain the implementation of? |
[] C language, whether we realize string variable name, variable substitution out Not directly variable time? ? ? |
[] C language, whether we realize string variable name, variable substitution out I also feel that the problem is indeed difficult, perhaps solve any problems.
Excerpts of the withheld before you sell me roof with it. |
[] C language, whether we realize string variable name, variable substitution out I want to study this issue about translation theory, then do not look feasible? It is now I do not know. |
[] C language, whether we realize string variable name, variable substitution out C should be achieved.
This function should be interpreted language (including compiler) can be achieved.
This can look at the "compiler principles". |
[] C language, whether we realize string variable name, variable substitution out We can look at the source code gcc, compiler compiler after the variable name is not preserved.
In translation, I would like to visit variable variable names should be removed. |
[] C language, whether we realize string variable name, variable substitution out Upstairs Supreme formidable. Where is the source gcc? |
[] C language, whether we realize string variable name, variable substitution out I really work with the landlord in the same needs, I realized is the definition of a structure array, and string variables corresponding name and the names of variables, for example :
Struct map
{
Char varname[20];
Void *pvar;
};
Struct map[]=
{
"Abc" abc.
"Abc1" abc1.
......
NULL, NULL
}
Through this array structure in the process of seeking correspondence between the two. Apply for admission under the general string variables are few places, so I use this method can meet the demand, and not too many definitions of the variables. |
[] C language, whether we realize string variable name, variable substitution out -->
You have to be the way to go. Hashing win_hate boss said, this is probably like it.
Thank you. :) |
[] C language, whether we realize string variable name, variable substitution out Hashing is a good use of attention
If c embedded Hashing support 好了~ |
[] C language, whether we realize string variable name, variable substitution out Hashing achieve months give examples, or show? |
[] C language, whether we realize string variable name, variable substitution out Language fails to provide this function.
Forest077 right is a way to construct a control relationship. Through fixed constants, such as Pointer |
[] C language, whether we realize string variable name, variable substitution out Ah. We already have a clear answer, this will leave the postings.
Conclusion :
1. C language does not support the use of variable name string to variable substitution out.
2. Solutions :
Hashing creation, variable substitution address preservation needs. |
| |