Special Characters | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 23

Special Characters

How can't we code Special Characters in C and C++ such as 🍉🍎 . Does C and C++ have unicode system declaring? Is it exit, lemme know.

25th Jul 2019, 12:43 PM
Aung Thiha
Aung Thiha - avatar
9 Answers
+ 7
You can enable utf-16 by writing _setmode(fileno(stdout), _O_U16TEXT); and then you have to use BOM(byte-order mark) which tells the compiler how the encoding/decoding should be done. wprintf(L"\xfeff") ; You will be needing two libraries fcntl.h and io.h for this purpose. To print emoji wprintf (L"\U0001f636"); wprintf (L"😊") ; If you want to print with C++ wcout << L"\U0001f636"; wcout << L"😊";
26th Jul 2019, 3:44 PM
blACk sh4d0w
blACk sh4d0w - avatar
+ 15
Coder you mean we can also use utf-16 or 32 in C and C++ too..right?
26th Jul 2019, 12:46 PM
Aung Thiha
Aung Thiha - avatar
+ 14
Coder it's also stdlib.h header .right? Thanks
26th Jul 2019, 12:52 PM
Aung Thiha
Aung Thiha - avatar
+ 14
I know it'll become kinda off topic, but pity you don't do python 🙂 we have a wonderful way to use utf 16 characters 😁 https://code.sololearn.com/cK0top56CXgL/?ref=app
26th Jul 2019, 4:48 PM
Humayra🇧🇩
Humayra🇧🇩 - avatar
+ 13
Coder yes it will work but it won't show the emoji. I guess it doesn't allow special characters.
26th Jul 2019, 12:59 PM
Aung Thiha
Aung Thiha - avatar
+ 11
nAutAxH AhmAd found the answer 😁😁 Thanks
26th Jul 2019, 3:45 PM
Aung Thiha
Aung Thiha - avatar
25th Jul 2019, 7:23 PM
blACk sh4d0w
blACk sh4d0w - avatar
+ 2
Really useful. Thanks
27th Jul 2019, 1:09 AM
P̷̖͒l̷͍̈ȕ̶̙t̴̤̐o̵̻̒ ̶̻̈́Ä̸̡́í̴̻ḓ̸̈́à̷̰n̷̩̈
P̷̖͒l̷͍̈ȕ̶̙t̴̤̐o̵̻̒ ̶̻̈́Ä̸̡́í̴̻ḓ̸̈́à̷̰n̷̩̈ - avatar
+ 1
I think so
26th Jul 2019, 3:11 AM
Odinakachukwu Franklin