Now consider this small program
char s[20]="One"; strcat(s,"Two"); cout<<s<<endl;
Here, first, s has the value "One", and for visual presentation, this is s:
O - n - e - \ 0
Then I add “Two” to the end of the line, creating this:
O - n - e - T - w - o - \ 0
Now that you see the only zero in the line first, after "One" now it is after "OneTwo"
My question is: Is NULL an overwritten string of "Two" and then adds its own zero at the end.
Or did the zero value that was already in the beginning return to the end again?
(This question may seem inappropriate, but I like to know about everything that I learn)
thanks
source share