The output of the below code is
Toto
TotoToto
but I would hope just
Toto
Toto
Why the second cout repeat the string in the output?
I'm using g++ version 7.5.0 on Ubuntu, I'm not sure if this is relevant.
The code is the following:
#include<iostream>
using namespace std;
int main(){
char c1[] = "Toto";
char c2[4] = {'T','o','t','o'};
cout << c1 << endl;
cout << c2 << endl;
return 0;
}