I am converting a large code base form C to C++. I got a compiler error for the following line of code:
char SingleDigit[2] = {" \n"};
error: a value of type "const char [3]" cannot be used to initialize an entity of type "char [2]"
" \n"
has just one whitespace.
Has the initialization of a char array changed for C
to C++
? Is " "
(with one space) actually a char array of length to (null termination).
Was this a bug in C
already?
I use the Intel compiler version 19.1.1.216 and Windows 10 for the C
and the C++
code.