I'm working on a program that accepts input and and outputs a numerical value corresponding to the input. I get the error on the char part. I don't understand why it would have an error like that when there's only 27 characters in the array that has a size of 27?
int main ()
{
char greek[27] = "ABGDE#ZYHIKLMNXOPQRSTUFC$W3";
}
You need one more
[28]
for the trailing'\0'
to be a valid string.Take a look to C Programming Notes: Chapter 8: Strings:
And as pointed out by Jim Balter and Jayesh, when you provide initial values, you can omit the array size (the compiler uses the number of initializers as the array size).