-
Easy Question
I have been searching the boards but could not find an answer to my question. I am trying to store a word. I have tried many different things but I think the closest was this:
Code:
char x[256];
switch (input)
{
case 1: answer = a + b;
char x = 'sum'; // wanting to store the word "sum"
break;
case 2: answer = a - b;
char x = 'difference'; // wanting to store the word "difference"
break;
case 3: answer = a * b;
char x = 'unknown'; // wanting to store the word "unknown"
break;
case 4: answer = a / b;
char x = 'quotient'; // wanting to store the word "quotient"
break;
}
I think I am on the right track, just my syntax is wrong.
-
-
or don't declare it in the beginning...
say
char x[] = "sum";
char x[] = "difference";
etc
wherever you need it.