#include <iostream>
#include <string>
using namespace std;
int main() {
string str {5, 'c'};
cout << str; // "\005c"
}
Output: c
With gdb, it confirms that str contains "\005c" with str[0] = '\005' str[1] = 'c'
Why str[0] is not being printed in output console? Used c++ version: c++11
Aucun commentaire:
Enregistrer un commentaire