Storing each character of a string into an array (c++) -
I have to make sure this code is reading properly
const int = 40; Four first string [SIZE], second string [SIZE];
It is creating 2 variable variables (called first string and second string) and is collecting characters that are in "first string" and "second string" Array is in them)? Is the name variable similar to name? (First string and second string)?
no, variable first string
, second string
Is the size of char
40.
Four first string [size], second string [size];
Only defines these arrays, that is, the compiler announces their names and causes it to allocate memory for them, that is it That is, 40
After this announcement (and in the same block), you can store user input in them (in C, string char
s).
Note that "variable" first string
, second string
can not exist together with these arrays: if they are in the same block If it has been declared then it will be a compilation error; If they are declared in the outer block, their names will hide by this declaration and their values will not have to do anything with these arrays. There will be no copy.
Comments
Post a Comment