-
writing characters...
I am having trouble figuring out how to store a letter into a variable of the type char. I have an example of some code below. Thanks in advance.
JK
Code:
#define number_of_letters 6
char letter;
enum type_of_letter
{
a,
b,
c,
d,
e,
f
}
for (i=0; i<number_of_letters; i++)
{
letter = ??? //want to copy the letter found in "type_of_letter" to letter.
}
-
Ummmm, that really isnt the way to go. Try using an array instead because enums are only integers (correct me if Im wrong), so in your code type_of_letter::a would be 0 I believe. Try something like this:
Code:
// bla bla bla
char type_of_letter[number_of_letters] = {'a','b','c','d','e','f'};
for (i=0; i<number_of_letters; i++)
{
letter = type_of_letter[i]
}
At least I guess this is what you want.
-
thank you that worked very well!