Hi i always mix up a NULL and '\0' and 0.
Can you write me when to use these things?
>i always mix up a NULL and '\0' and 0.
The short answer is that you use NULL with pointers, '\0' with characters, and 0 with everything else.
The long answer is that '\0' and 0 are identical. In C they're both integers with the value 0. You can use them interchangeably, but it's best to only use '\0' in a character context, because it's a character literal. You can use 0 at any time because it's so multi-functional and that fact is well known. You're less likely to confuse people.
NULL is not interchangeable with '\0' and 0 because it may be cast into a pointer type:
#define NULL ((void*)0)
Therefore you can only safely use NULL in a pointer context because if it casts the expression to void*, you'll get mysterious warnings and errors when using NULL in a non-pointer context.
 In other words, the standard doesn't require this. It says that "an integer constant expression with the value 0, or such an expression cast to type void*, is a null pointer constant". So you can use 0 instead of NULL in a pointer context as well. 0 always works. NULL may also be defined just as 0, but you can't be sure of it.
I am trying to send a message to my websocket server but I keep getting this error.
Traceback (most recent call last): File "send.py", line 5, in <module> ws = websocket.create_connection("ws://ipaddress:9001") AttributeError: 'module' object has no attribute 'create_connection'
I created a python server file server is started but when I ...
I have two tables, I will call them first-half and second-half (of the year)
Table: first id jan feb mar apr ----------------------- 2 80 90 70 60 3 50 40 60 30 Table: second id jan feb mar apr ----------------------- 2 50 70 60 90 3 80 60 50 ...
Hi when I tried to insert my output the void displayed null or 0 can you tell me what's wrong with my rpogram? tnx
My main program
int choice; public static void main(String args) Scanner absorb = new Scanner(System.in); // phase 1 login cloth cl = new ...