how to initialize char array

hi,
I'm writing a program that shows a point value based from a grade that the user input i.e if the user input A+ the point value will be 5.0, but i don't know how to initialize the char array , i tried to do it like this

char grade [11] = {'A+','A','A-','B+','B','B-','C+','C','D+','D','F'};

but it says multi-character constant, so I changed it into

char grade [11] = {"A+","A","A-","B+","B","B-","C+","C","D+","D","F"};

then it says too many initializers for 'char [11]'
"a+" does not equal 1 char.

"a" = one char.

You might need to rethink your approach or use a different data type, like string.
actually
"a" is 2 characters, {'a', 0}

'a' is one char.

you can't do this in 1 byte.
you either need to designate a different approach (for example, 'a' means normal a, and 'A' means a+) or use full strings so you can store "A+".

Last edited on
Topic archived. No new replies allowed.