Quote:
Originally Posted by Riwerry
Yeah, but what can happen if I don't use that null \0 value?
|
It doesn't matter - the NULL terminator is automatically included at the end of a string by default, even if you don't explicitly specify it.
If you want to create an array and you only need xx characters (32, 64, 128), then there must always be one extra cell for the null terminator. In case you're planning on using all of the cells in an array, there needs to be one more extra cell for the NULL terminator to be fit within!
However, you could do this:
pawn Код:
new str[24] = "I am so awesome, dude.";
str[15] = '\0';
print(str);
Would output: