While the title of this thread might not make all that much sense, I'm going to attempt to explain:
I have this small C program, and I'm trying to do something that I would expect to be pretty easy (It's command line). I want this program to ask for user input, and then access a variable that the user enters. So it would work like this:
Hopefully that made sense. If there's no way to write a program that does exactly that, how would I write one that works similar? This is just a small part of a larger project. Thanks for any help and suggestions!
Edit: Also, this has to be done without an if statement, so that it's extensible. That's where it seems to get more complicated...
I have this small C program, and I'm trying to do something that I would expect to be pretty easy (It's command line). I want this program to ask for user input, and then access a variable that the user enters. So it would work like this:
Code:
double a = 1;
double b = 2;
double c = 3;
(program asks for user input)
(user enters "a" (without quotes))
(Then, the program would output 1, because that's the value of a)
Hopefully that made sense. If there's no way to write a program that does exactly that, how would I write one that works similar? This is just a small part of a larger project. Thanks for any help and suggestions!
Edit: Also, this has to be done without an if statement, so that it's extensible. That's where it seems to get more complicated...