Sizeof(a) must be 4 bytes, but why does the overflow occur when I enter at least over 32 characters?!
Thanks for help...
Code:
// HHHe... #include <iostream> using namespace std; int main() { char a[4]; string str; cin >> str; cin.ignore(); int i; for(i=0; i<(str.length()); i++) { a[i] = *(str.c_str()+i); } /* char * p = &(a[7])+i; cout << *p << endl; */ }
Comment