I'm having a problem printing letters using a for loop..
I have this code:
The problem is what if I want to print out all the letters to Z? Obviously, putting all letters inside the letter array isn't really the best idea so I was wondering if something similar to this is possible:
I'm getting invalid unicode escape error on that code .. Thanks!
if you are looking for a technique to print out the letters then you could probably do this as well
I believe you are getting the invalid unicode error cause at compile time the compiler is looking for 4 digits after \u and since you only 3 it gives the error
Actually, your first code snippet has a bug. Line 4 should probably read:
I think Unicode escapes need to be two characters (i.e., \uNN) or four characters (\uNNNN). In any case, your second snippet won't work the way you think it will. You'll just print out whatever the Unicode character is, plus the number, six times. The plus just concatenates them in the output.
A character written between single quotes representing an "integer value" equal to the numerical value of the character in the machine's character set(Unicode,ASCII etc.)
So, if you try to print the integer equivalent of any character(i.e whatever unicode uses to represents a symbol), as a character, you will get a character constant.
For e.g: Integer equivalent of A,B and C in Unicode are 65,66 and 67. So, the following
will print A,B and C.
Using this idea you can print any character in the Unicode character set.