answersLogoWhite

0

Difference between null and empty in c plus plus?

Updated: 8/18/2019
User Avatar

Wiki User

10y ago

Best Answer

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.

User Avatar

Wiki User

10y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Difference between null and empty in c plus plus?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What is the difference between private stafford and plus student loans?

What is the difference between private stafford and plus student loans?


In PHP a null value plus a number value is equals to what result. example null plus 6 equals?

In php mathmatical operations treat null like 0, so any number plus null equals itself. For example #!/usr/local/bin/php printf ("%d\n", null+6); printf ("%d\n", 6+null); ?> output: 6 6


What is the difference between a C plus plus string and a C-style string?

A std::string is an object that encapsulates an array of type char whereas a C-style string is a primitive array with no members. A std::string is guaranteed to be null-terminated but a C-style string is not.


What is null object in c plus plus?

a pointer that is not pointing to anything


What is the answer to w plus 3 equals w plus 6?

w+3=w+6 obviously doesn't equal itself... subtract w from both sides and you are left with 3=6 So the answer is NO SOLUTION, or as a set, it is the empty or null set.


What is the difference between pointers in c and c plus plus?

Nothing.


What is the difference between be plus ing and get plus ing?

There are no such terms in C++.


Why you use zero instead of NULL in c plus plus?

In C++ NULL is defined as 0. It's a design failure, will be fixed with a new 'nullptr' keyword.


What is the difference between statements in c plus plus charconstp and char constp?

There is no difference. Both statements are invalid.


What is the difference between Nike plus and Nike plus Active?

They have different names


What is literal in c plus plus?

Examples: 1, -1, -2.5, 'a', "Hello", NULL


What does malloc return in C and C plus plus?

Address of the allocated area, or NULL.