T
T
Taras Parashchuk2020-08-19 12:48:55
C++ / C#
Taras Parashchuk, 2020-08-19 12:48:55

Why does the Codevision "too many initializers" error occur?

Hello.
The code throws an error "too many initializers"
"too many initializers"

#define buffer_MAX 16
char buffer[buffer_MAX] = "0123456789ABCDEF";

And so for some reason it works, probably the compiler settings affect, but all the same, all this is strange
#define buffer_MAX 16
char buffer[16] = "0123456789ABCDEF";

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
AnT, 2020-08-19
@TheCalligrapher

"It doesn't work like that, but it works like that" is, most likely, some kind of fiction and / or reticence. There is no difference between these two options.
Otherwise:
1. This initialization is correct in C and incorrect in C++.
2. The standard C compiler in CodeVision contains a known bug, due to which it refuses to accept this completely correct code. Although the error message is worded differently.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question