GAMERS LAIR

Sub Zero

Well-known member
Messages
208
Points
93

WhatNitrous

Well-known member
Messages
23,454
Points
113
I still don't quite get difference between zero and null. :LOL:
Null is an empty value that means 'Nothing' or 'Never Used', you use it to determine if a variable exists or has ever had a value assigned to it before if it can be completely empty.

For example if you have a variable that should be zero but you need to know if its ever been set to zero or its never been used, Null would be the alternative to zero.

In most cases its used for strings and/or variables that point to an address in memory more than numbers...but thats the simple drift of it. Null means to not exist and zero just means its zero like a string can be "" but its not empty...null would be empty.

EDIT:

Null is memory address zero (in low level at least) where zero is an integer that has a different memory address.
 

Sub Zero

Well-known member
Messages
208
Points
93
Null is an empty value that means 'Nothing' or 'Never Used', you use it to determine if a variable exists or has ever had a value assigned to it before if it can be completely empty.

For example if you have a variable that should be zero but you need to know if its ever been set to zero or its never been used, Null would be the alternative to zero.

In most cases its used for strings and/or variables that point to an address in memory more than numbers...but thats the simple drift of it. Null means to not exist and zero just means its zero like a string can be "" but its not empty...null would be empty.

EDIT:

Null is memory address zero (in low level at least) where zero is an integer that has a different memory address.
I'm reading for a 3rd time and trying to understand it better. Thanks Nitrous. :)

This picture nails it just right 🤣🤣🤣
Yea it makes more sense, a picture is worth a thousand words. 🤷‍♂️
 

WhatNitrous

Well-known member
Messages
23,454
Points
113
I'm reading for a 3rd time and trying to understand it better. Thanks Nitrous. :)
I tried lol
Yea it makes more sense, a picture is worth a thousand words. 🤷‍♂️
0 is an empty seat that has something in it...null is just empty 🤷‍♂️

In something like java its pretty much the same thing...in lower level languages like C/C++ its a massive difference.

The difference in those languages is you use it to tell if its "empty" where zero could be used as well as negative numbers for integer values. Its all a matter of just knowing it means empty in higher level languages.
 
Last edited:

WhatNitrous

Well-known member
Messages
23,454
Points
113
It's OK now, I get it. So if you set something to NULL it's like delete? It points to nothing in memory. 🤔
err...don't thonk of it like that because you need to delete memory in those languages too, they dont do automatic garbage collection like some.

Its usually used where you dont even need a variable like in API calls into the Windows DLLs.

C++:
struct POINT {
    long x,
    long y
} *LPPOINT;

BOOL CheckForPoint(LPPOINT lpSpot) {
    if (lpSpot == NULL) return FALSE;
    // point exists so do something with it...
    return TRUE;
};

i'm all sorts of rusty and typed that by hand so forgive the fact it'd likely error but thats the principal behind it.

LP means long pointer btw, which is a memory address.
 
Last edited:

Sub Zero

Well-known member
Messages
208
Points
93
Its usually used where you dont even need a variable like in API calls into the Windows DLLs.
Honestly I'll try to understand it later but thanks for your help. :) (y)

I'm afraid to try again now but I did like 20 times :LOL:
I tried maybe 50 times and still can't login into my EPIC account.

I tired using my laptop, my phone, reset router to get a new IP. I'm still banned. WTH? :oops: Try once and if it doesn't work just wait don't get blocked like me.

So, they are on the case.
Good to know maybe they unblock me. 🙏
 
Top