SA-MP Forums Archive
[QUESTION]: Difference between.... - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: [QUESTION]: Difference between.... (/showthread.php?tid=487258)



[QUESTION]: Difference between.... - TH3_R3D™ - 12.01.2014

Hello,

I was wondering what's the difference between 'NULL' & '0' ?
-I think they're equal but Am I right?

Thanks in advance-


Re: [QUESTION]: Difference between.... - SilentSoul - 12.01.2014

Quote:

Strings in PAWN (and other languages) are what's called "NULL terminated", this means that when 0 is reached, the string ends. This is not the same as the character "0", represented by the number 48, this is the NULL character, represented by the number 0. This means that you can have a string array 20 cells large but only have a string 3 characters long if the fourth character is the NULL character, signalling the end of the string. You can not however have a string 20 characters long as the NULL character MUST be in the string, so in a 20 cell array you can have a 19 character string and a NULL termination character.

Source : https://sampwiki.blast.hk/wiki/Scripting_Basics


Re: [QUESTION]: Difference between.... - Vince - 12.01.2014

Null is unknown. Unknown isn't equal to 0. For example, if you'd want a database entry for the amount of pets someone has: if you don't know the answer, you put NULL. If you know he has none, you put 0.


Re: [QUESTION]: Difference between.... - TH3_R3D™ - 12.01.2014

Quote:
Originally Posted by SilentSoul
Посмотреть сообщение
Quote:
Originally Posted by Vince
Посмотреть сообщение
Null is unknown. Unknown isn't equal to 0. For example, if you'd want a database entry for the amount of pets someone has: if you don't know the answer, you put NULL. If you know he has none, you put 0.
Thanks a lot.