answersLogoWhite

0


Best Answer
Answer

Programming languages store data in different data types. A zero value would belong to a numeric data type such as float, single, double, integer, long, etc. A null string is a variable that references a string (sequence of characters) that is not yet pointing to anything.

Answer

A null string can also be a string of zero length.


Answer
Several programming languages including C and C++ and several assembly languages store strings in "ASCIZ" format, also called "C string" format.
In those languages, a string variable contains only a pointer to the first character in the string, and the end-of-string is marked with the ASCII NUL character.
A programmer using strings in "ASCIZ" format must be aware of the two different ways that a string variable may store no characters:

One way a ASCIZ variable may store no characters:
A string variable may contain the null pointer constant, which is represented by the constant integer 0. All such "null pointers" point to the same location, represented by the constant integer 0, and often called NULL.
No valid string is ever located at that location.
For example,
char * winner_name = 0;
or equivalently
char * winner_name = NULL;
Typically a programmer must write explicit code to check for this possibility first.
For example,
if( winner_name ){ cout << " The winner is: " << winner_name << " !\n"; };

The other way a ASCIZ variable may store no characters:
The string variable may contain the address of a valid memory location that contains no other characters before the end-of-string NUL character.
Some programs have many such locations in memory, located at a variety of addresses (that address is stored in the string variable), that contain such a "null string" or "zero-length string".
For example,
char buffer[BUFFER_SIZE] = "";
or equivalently
char buffer[BUFFER_SIZE] = {'\0'};
.


Sometimes programmers can write the code that handles normal strings in such a way that that code also handles zero-length strings, with no explicit check for a "zero-length string" possibility.
User Avatar

Wiki User

14y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is difference between zero value and NULL strings?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

What is the difference between an array shift and unsetting a variable in PHP?

By shifting the values in an array, you are moving a key's value to the previous key. The very first key's value is obliterated. By shifting all values in the array, all keys will have a value of NULL. Unsetting a variable is entirely different -- performing a variable unsetting causes the variable to have a value of NULL, as if it was never set.


What is the difference between null pointer ASCII null character and null string?

A null pointer is a pointer which does not point to any valid memory location, and usually contains the binary value "0" to represent this (this is language dependent). The ASCII null character is a character-sized zero value (in ASCII, it is an unsigned byte with a value of 0), and typically represents the end of a string (esp. as in C and C++). A null string is one that is zero characters of usable string data; in a length-based string, this means the length parameter is set to 0, and in an ASCII null-terminated string, means the first character is set to 0.


Why null values in database?

The 'null'-content of any given field is just that. It's a 'nothing'. Example, if you create a database to hold chemical values for instance. If the values are, for example, real nubers. That would imply that any value that has 0 in it, is just that; zero. It was beeing measured, and found to contain zero. On the other hand if a value was not tested, the value of that compound should be set to 'null'. If a 'null' value isn't supported by the database a workaround is to set 'null' values to -1 (as per the example above). --


What is null character?

A Null Character, is a control character with a value of zero.


What are the difference between null and undefined in Javascript?

EMPTY STRING-it is a unique string of length zero.the empty string is still a sring upon which strin operation may be attempted.NULL STRING-In programming ,a character string that contais no data.

Related questions

What is difference between null value and not null value?

Putting it very simply a null value is empty and a not null value contains something.


What is the difference between Strings and Arrays in c?

There is no difference. A string is just an array of type char. The only real difference is that we do not need to keep track of the length of a string because strings are null-terminated in C. If a string does not have a null-terminator, then it is just an ordinary array of character values.


What is the defualt value for String in java?

The default value for objects is null; I believe this would apply to a String, too, since Strings are objects.


What is the difference between equals 0 and equals NULL?

NULL is for pointers, 0, for numbers


What is the difference between 0 and null?

Nothing - 0, Zero and null are the same things


What is the difference between null in c and in oracle?

A NULL in C is a pointer with 0 value, which cannot be a valid address. A null in Oracle is the condition of not having a value, such as a field in a row being null, meaning that it does not have a value. This is not the same as zero - zero and null are two different things. Note, however, that Oracle does not differentiate between a null and a zero length string. This was an error in non-ANSI implementation made many years ago, but it has persisted because fixing it would impact too much "running" code.


Difference between null and empty in c plus plus?

NULL is a constant with the value zero. It is typically used with pointers to signify the pointer is valid, but it does not store a valid memory address. In other words it points at nothing in particular. It is nullified. All pointers that are not currently in use must be nullified to signify the fact they are not in use. The term empty applies to arrays that have no elements: empty arrays. We also use the term when referring to empty strings. A string is simply an array of char, but while null-terminated strings always have at least one char, the null-terminator, the string itself is empty.


What is the difference between strcpy and strncpy in c language?

strcpy is meant to copy only null-terminated strings. It is probably implemented to copy every byte until it encounters a #0. strncpy() copies n bytes and it adds null termination at the end of the target string.


How does the difference between fe and fo influence the outcome of a chi-square test?

The larger the difference, the larger the value of chi-square and the greater the likelihood of rejecting the null hypothesis


What is the difference between zero vector and null vector?

They are the same.


What is the difference between a null hypothesis and a research hypothesis?

The null hypothesis is the default hypothesis. It is the hypothesis that there is no difference between the control group and the treatment group. The research hypothesis proposes that there is a significant difference between the control group and the treatment group.


Difference between p value and level of significance?

P- value is the probability that the given null hypothesis is true and the level of significance is the chance in a hundred or thousand off occurence of an event i an outcome