C++ char data type and the difference between character and string literals [5]
Vložit
- čas přidán 6. 06. 2023
- Learn about the character data type and the difference between character and string literals in this C++ tutorial for beginners using Visual Studio 2022 C++ .
// Learn more:
CH02: Introduction to C++ ⇒ • CH02: Introduction to C++
// Join the new Programming for Everyone Community Forum:
professorhank.freeforums.net/
// Consider supporting this channel in multiple ways
paypal.me/hankstalica1
Bitcoin: 177wfkQwzXiC8o2whQMVpSyuWUs95krKYB
thank you so much for this amazing vedio
Most welcome 😊
Thank you for this very useful video!
You're very welcome!
this was very helpful thank you :)
Glad it was helpful!
Is there a reason strings are preferred? My understanding is that you can set up a char *array[n size] and achieve similar results?
Strings are easier to work with than arrays of characters. For one example, a < b is easier than strcmp(a, b) or a + b as opposed to strcat(a, b).
Stuff like that.
Thx Bro, nice video! What is the IDE btw?
Glad you liked it! The IDE is Visual Studio Community 2022.
This is in C++. But what happens when a CSV file created by C++ contains strings, the store space is incremented by one per each string ?
How Python read the CSV created before? It takes account of the \0 last character?
A CSV file is just a text file formatted a certain way. Either don't write \0 to the file or have your Python program deal with it when it reads the CSV file.
@@ProfessorHankStalica As you said a string created in C++, have a char \0 at the end => length+1 right?
A string created in Python length = length right?
CSV is a text file => 1 char = 1 byte then a CSV file created with C++ will have a char added to each string right?
Then how I have to save the string to don't include a char \0 added from C++?
Thank you!
@@higiniofuentes2551
Here's an example:
char str[] = "Hi";
.
.
.
fout