John Matthews wrote:So what are the single characters for? And the switch is only executed once - it can't set multiple array elements; should it be inside a loop? And the switch just does printf(), it doesn't assign any values to the array.
David Simic wrote:I want to add "fi gg kk rr" into array using switch
I feel like you don't understand what a switch does, which is why I wrote the if/else if version. Do you see why switch(test) might cause a crash?
John Matthews wrote:explain what -> explain how
John Matthews wrote:Hi David
You define the array as being 3x3, but only initialize 2x3.
David Simic wrote:
A valid array index is in the range 0..2; test is outside the array you have defined. What is it you are attempting to switch on?
Campbell Ritchie wrote:More likely twenty‑four. You go from queen to black queen on black square, black queen on white square, white queen on white square and white queen on black square.
Tim Holloway wrote:. . . double the number of templates (12 instead of 6). . . .
Tim Holloway wrote:C and C++ are not that much different, and both are so close to the hardware that it's mostly a matter of brute force.
I believe that there's a compiler switch to force the primitive type "char" to be either traditional (8 bits) or wide (16 bits). You need 16-bit characters to hold the extended Unicode characters. Or you could just plow through with UTF-8, but since all the characters in the chess subset of Unicode are 16 bits anyway, why bother?
Of course, none of this does any good at all unless the output system is set up to display Unicode. So make sure you are outputting to a terminal device (or whatever) that can handle it. And that has been instructed to handle it.
Campbell Ritchie wrote:Yes, but would you want to? I have found out that you can print Unicode in C++. Haven't found anything for C.
Shell Meister wrote:. . . is it possible to make something in C that looks like this . . .
Campbell Ritchie wrote:Welcome to the Ranch
Can you display Unicode symbols? Look here.