I want to explain about the type of variable char in C++? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

I want to explain about the type of variable char in C++?

.

16th Apr 2023, 11:21 PM
Salam Tamam Kasm
Salam Tamam Kasm - avatar
4 Answers
+ 10
Salam Tamam Kasm , here is link to a short sololearn tutorial about *char* type. see also the other links about *data types* and *variables*: it is also recommended to practice what you have learned. https://www.sololearn.com/learn/CPlusPlus/1623/?ref=app https://www.sololearn.com/learn/CPlusPlus/1621/?ref=app https://www.sololearn.com/learn/CPlusPlus/1606/?ref=app
17th Apr 2023, 6:20 AM
Lothar
Lothar - avatar
+ 4
Char: delimited by single commas (‘ ‘). Just a sigle character. Example: ‘a’. String: delimited by double commas (“ “). An array of characters. Example: “hello”. In C we declare strings as an array of chars: char arr[10] = “Hello”; This is the fundamental difference.
17th Apr 2023, 6:32 AM
Ugulberto Sánchez
Ugulberto Sánchez - avatar
+ 4
A char is a data type that represents a single character. It is one byte in size (on most systems). We can utilise char arrays to make C-styled strings, such as const char* greeting = "Hello, Salam!"; Generally for strings, we should use std::string as it has been well tested and has a wide range of useful functionality. If you would like more help or more information, please feel free to let me know, I would be more then glad too!
17th Apr 2023, 7:00 AM
Sickfic
Sickfic - avatar
16th Apr 2023, 11:33 PM
BroFar
BroFar - avatar