Question about char input

Posted by DomX23 on Stack Overflow See other posts from Stack Overflow or by DomX23
Published on 2010-04-26T07:42:09Z Indexed on 2010/04/26 7:43 UTC
Read the original article Hit count: 211

Filed under:

This is what I'm trying to do...

char input[4];
cin >> input;
cout << "Input[0]: " << input[0] << "Input[1]: " << input[1] << "Input[2]: " << input[2] << "Input[3] " << input[3]<< "Input[4] " << input[4] <<endl;

However, when I enter "P F" I get an out of this: Input[0]:P Input[1]: Input[2]: Input[3] Input[4]

Why do I get that weird character instead of F?

© Stack Overflow or respective owner

Related posts about c++