What is the difference of “Character” in Swift and “char” in C/C++? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What is the difference of “Character” in Swift and “char” in C/C++?

Sometimes we need to get the ascii value of a “char”, but in Swift, a “Character” means an Unicode. What is the difference between them? And has some particular tech or method to treat and handle “Character” in Swift?

31st Aug 2023, 4:59 AM
Kirayuyu
Kirayuyu - avatar
2 Answers
+ 1
Character is a data type in Swift in Java Character is class which can have different methods. char is also data type which holds a single character.
31st Aug 2023, 11:27 AM
A͢J
A͢J - avatar
+ 1
character and char both are data types character -> swift char -> C++ ASCII = American standard code information interchange
31st Aug 2023, 4:33 PM
Alhaaz
Alhaaz - avatar