08-26-2022, 09:37 PM
(08-26-2022, 08:36 PM)TempodiBasic Wrote: never seen this way to assign a value to a string variable in CThat is a syntax error in C, perhaps not in C++. I've seen stranger things happen with C++ code, perhaps square-bracket operators were overloaded? Otherwise the intention of the programmer looks like one of the letters is being extracted.
buf[p][0]="CDEFGAB"[(n+700000)%7];
Just doing buf[p][0]="CDEFGAB"; might not be allowed in C, must allocate memory for pointer for string "array", then more memory for each member of the array and then use "strcpy()" or something like that from "string.h". This is just my near-fundamental knowledge of that programming language...