I need an explanation please, I want to insert a sentence, and then do all kinds of actions on it. My problem is that when I try to print the sentence I wrote, he prints only the first word. I do not want to use the string, except in the form I wrote.
int size = 10;
char* str = new char[size];
for (int i = 0; i < size; i++){
str[i] = NULL;
}
cin >> str;
for (int i = 0; i < size; i++){
cout << str[i];
}
input:
abcdef abc
output:
abcdef
When I set the array of char * how it looks, like that?
char* str = new char[10]; >>> [pointer?][garbage?][Something else?][][][][][][][]
thank's.