HELP. I am very new to c++ and am not quite understanding strings and arrays can someone help me out plzzzzzz....
HELP. I am very new to c++ and am not quite understanding strings and arrays can someone help me out plzzzzzz....
First tell us what it is you don't understand, then someone might be able to help you. If you don't know what you don't understand, go read some more tutorials/books.
An array is a sequence of items with the same type, such as int or char. A string is a sequence of chars that always end with the '\0' character. A C string is an array of those chars where the last element in the array is the nul. The C++ string class is god's gift to programmers, C strings have a set length and it takes some tweaking to change the length if you want to, but the C++ String class can dynamically change it's length with fair ease
Array:
char a[] = {'a','b','c','d'};
C String:
char a[] = {'a','b','c','d','\0'};
or the short form which is the same
char a[] = "abcd";
C++ String:
string a = "abcd";
I can explain more with a better idea of what you don't understand.
-Prelude
My best code is written with the delete key.