Here is a simple code snippet:
char note[3] = {'C', '#', '4'};
char note_stops[12];
if (note[1] == '#') {
note_stops= {'C', '#', 'D', '#', 'E', 'F', '#', 'G', '#', 'A', '#', 'B'}; // The symbols '#' represent sharp notes. (i.e. note_stops[3] is "D#")
} else {
note_stops= {'C', 'b', 'D', 'b', 'E', 'F', 'b', 'G', 'b', 'A', 'b', 'B'}; // The symbols 'b' represent flat notes. (i.e. note_stops[3] is "Eb")
}
Here is error code (ignore line numbers):
compose.c:29:24: error: expected expression
note_letters = {'C', 'b', 'D', 'b', 'E', 'F', 'b', 'G', 'b', 'A', 'b', 'B'};
^
compose.c:33:24: error: expected expression
note_letters = {'C', '#', 'D', '#', 'E', 'F', '#', 'G', '#', 'A', '#', 'B'};
^
I researched this error very much, but I can't seem to find (or realize) what's exactly wrong here. What is wrong with the code?
= { ... };syntax. They cannot be assigned to using that syntax.memcpyan array. Only a simple variable type can be copied with=unless you have the data inside astruct. Then you can copy the wholestructwith=operator.