c++ - Difference between null terminated char (\0) and `^@` -
my codes this:
#include <iostream> using std::cout; using std::endl; int main(int argc, char *argv[]) { cout << (int)('\0') << endl; cout << (char)(0) << endl; homecoming 0; }
i expected see in terminal this:
$ test-program 0 $
however, saw this:
$ test-program 0 ^@ $
what makes me confusing think '\0'
can converted 0
. , 0
can casted \0
. expected see null char followed endl
, result weird ^@
.
does have ideas this?
^@
how terminal emulator renders '\0'
.
c++ c arrays string char
No comments:
Post a Comment