By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,778 Members | 1,947 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,778 IT Pros & Developers. It's quick & easy.

A very interesting question...!

P: 84
It was when i was programming when the doubt came to my mind:
I was wondering whether it was possible to show the content of a var by writing its name, like this:

char name[15];
gets(name);
int number = 30;

if the user types in "number", then it should look for "number" and show its value, in this case 30. Is there any way to do this???
Mar 19 '07 #1
Share this Question
Share on Google+
1 Reply


100+
P: 1,646
Yes you can use a switch statement and test the user input for matching variable names and then output the value if it matches
Mar 20 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.