cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
Beginners
arbitrary number of variables without us
arbitrary number of variables without using arrays
Dec 6, 2011 at 8:25am UTC
ravar
(7)
is there a way were i can create a variable with a variable name and then how would i acess said variable.
Dec 6, 2011 at 1:42pm UTC
coder777
(8444)
You can use std::map
http://www.cplusplus.com/reference/stl/map/
like so:
1
2
3
std::map<std::string,
int
> foo; foo[
"bar"
] = 100;
int
val = foo[
"bar"
];
Topic archived. No new replies allowed.