473,503 Members | 1,657 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

difference between null and zero!

1 New Member
hello everybody ,
I need to know the right and correct difference and similarity between ZERO AND NULL !
Apr 30 '15 #1
5 1536
weaknessforcats
9,208 Recognized Expert Moderator Expert
who knows?

The way to find out what NULL is to look in your stddef.h header and see. NULL is not part of C but is, instead, a defined constant. In C++ NULL is deprecated.

Do not assume NULL is 0. If you mean 0 then use 0. You see, NULL could be and int 0 or it could be a char \0.

Personally, I have never used NULL.

I have never heard of ZERO.
Apr 30 '15 #2
donbock
2,426 Recognized Expert Top Contributor
Suppose you have two constants in your program: one of them is CentimetersPerInch and the other is DistanceHomeToWorkKilometers; and they happen to both be equal to 2.54. These are two very different things despite them happening to have the same value.

What have you been taught about NULL?
Apr 30 '15 #3
MonikaSR
3 New Member
Zero is a unique value and known quantity of zero, which is meaningful in arithmetic and math.
Null is a non-value. It takes only the place for that value which is not specified or not known. And mathematical operation cannot be done with Null value.
In computers when we done operation on a null variable it will result in null value or either shows an error condition. Because the variable value is not known so the result of the expression is not known.
More clearly understand by taking an example: Someone ask to you, what is your yearly income? Its answer must contains a numeric value like “0” which is perfect and valid answer who has no investment and does not work. And if you tell this to your software you do not enter any value because the value is not specified. So, to allow the software to continue you put “Null” value to fill that place.
Apr 30 '15 #4
HenilGandhi
1 New Member
zero (0) is a number, and NULL is a value that represents "no value". As such, 0 can be added, subtracted, etc., but NULL cannot.
May 3 '15 #5
donbock
2,426 Recognized Expert Top Contributor
The token NULL is well-defined in the C Standard. It is a value that can be assigned to any data pointer or that any data pointer can be compared against. A pointer whose value is NULL does not currently point to anything. Dereferencing a NULL pointer is undefined behavior.

Alhough the concept of a null value for other types of variables is conceptually similar to NULL pointers, there is no support for them in the C Standard. Support for no-value-entered-in-this-field is ad hoc.
May 4 '15 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

3
2413
by: lkrubner | last post by:
Suppose I make a call to MySql and zero rows come back. How do I tell the difference between zero rows and failure?
53
8090
by: Zhiqiang Ye | last post by:
Hi, All I am reading FAQ of this group. I have a question about this: http://www.eskimo.com/~scs/C-faq/q7.31.html It says: " p = malloc(m * n); memset(p, 0, m * n); The zero fill is...
102
5901
by: junky_fellow | last post by:
Can 0x0 be a valid virtual address in the address space of an application ? If it is valid, then the location pointed by a NULL pointer is also valid and application should not receive "SIGSEGV"...
0
1705
by: Raed Sawalha | last post by:
I'm capturing the screen using the following code , but the problem i have that after 43 calls of the functions the NULL reference object is returned , SIZE size; //Here we get the handle to...
10
5854
by: Flip | last post by:
I know the int.Parse("123") will result in an int of 123, but what happens with a null? I believe it give a null exception (seems like I get either NullArgumentException or ArgumentNullException...
3
5866
by: Asha | last post by:
greetings, i have some questions below, what are the differences between private string _strVal = string.Empty; and _strVal = null; does the string.Empty; allocate memory for it? how about...
4
2461
by: Randall Parker | last post by:
I am designing a database schema. It happens to be in MySQL but I'm trying to keep it portable to other databases should the project grow. Anyway, suppose you have VARCHAR fields and will be...
0
1217
by: z.ghulam | last post by:
Hi, I have a line graph used to tally up the number of orders each engineer does in a week. This works well apart from 2 things: 1) If an engineer is off for a week or completes 0 orders, then...
1
1325
by: nicholas s | last post by:
Hi, I hope you can help with what may seem a simple question - I need to describe the difference between 2 values - 0 and 5 - to show their difference, ie zero enrolments in one year and 5...
8
5166
by: lak | last post by:
What is the difference b/w '\0' and NULL? In which case It is useful?
0
7072
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
6979
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7449
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
4998
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4666
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3160
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3149
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1498
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
730
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.