A
arnuld
hai all,
here is the code:
#include <iostream>
#include <string>
int main() {
std::string s;
std::cout << s[0] << std::endl;
}
now i know it is WRONG as "s" is an empty string (implicit
initialisation by the default constructor of string class from Std.
Lib.). what i want to know is, when i run this code onto my Debian box
"gcc 3.3.5" it outputs the following characters:
"^@"
what is that? some non-printable character from ASCII, i guess.
do we call this an undefined behaviour?
thanks
"arnuld"
www.arnuld.blogspot.com
here is the code:
#include <iostream>
#include <string>
int main() {
std::string s;
std::cout << s[0] << std::endl;
}
now i know it is WRONG as "s" is an empty string (implicit
initialisation by the default constructor of string class from Std.
Lib.). what i want to know is, when i run this code onto my Debian box
"gcc 3.3.5" it outputs the following characters:
"^@"
what is that? some non-printable character from ASCII, i guess.
do we call this an undefined behaviour?
thanks
"arnuld"
www.arnuld.blogspot.com