answersLogoWhite

0


Best Answer

There is no null array as such. However, a pointer to an array may be nullified (pointing to zero) before memory is allocated to it, or after that memory is released. But the same is true of any pointer. That is, the pointer is NULL, not what it previously pointed to.

An empty array usually refers to a dynamic array for which no memory has yet been allocated (in other words, a null pointer). However, the term can also apply to static arrays or dynamic arrays that have been allocated memory, where every element is initialised with a value that has no significance. For instance, an array of natural numbers (positive integers greater than 0) might be initialised with the value 0 (a non-natural number) in every element to indicate that the array is empty. By contrast, individual elements could be set to zero to indicate which elements are available (an empty element as opposed to an empty array).

User Avatar

Wiki User

11y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is the difference between null array and an empty array?
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 NULL array in C Language?

There is no "NULL array" as such, you may take a pointer to an array and set it to NULL (binary 0) e.g. int* foo; // Declare a pointer foo = malloc( 40 * sizeof(int)); //Allocate an array of 40 integers pointed to by "foo" foo = NULL; //Set the pointer to NULL, if you're using a garbage collector this should trigger an automatic free() of the memory allocated to the array. If you are NOT using a garbage collector (which is more common in C) this line is a memory leak.


How do you set the null value in array?

Depends on the programming language, some languages may have already initialize an array with null (or the default value of the type), some of them require explicitly assignments by stepping through each element of that array, and assigning them with null. (imperative languages)


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.


How can i check a null at the end of an character array in java?

A character array, by nature, is a primitive-type data array. It can't contain a null value. You cannot cast a char as a null. char[] charArray = {'1','2','s',null}; //this doesn't compile. However, if you have an array of Character objects, then it's possible. Character[] charArray = {'1','2','s',null}; //this DOES compile A proposed algorithm is to initialize a test boolean as false, then use a for loop to iterate through the array. Set the flag to true (and break the loop) based upon whether one of the objects you run into is null. What you do from there is up to what the rest of your code says.

Related questions

What is the difference between array and string of array?

When we declare an array of characters it has to be terminated by the NULL , but termination by NULL in case of string is automatic.


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.


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 string and char array?

3 differences.................. 1. length wise.... 2.initialization 3. null terminated length of char array is differ from string........ initialization of string is differ from char....... and string is null terminated...........


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.


How can one prove that an array is not null but emptyin java?

You can copy paste the below code into a file named Test.java and execute it. inside the main block you can see the if condition. check if the list is not null and then use the size parameter of the array list to check if it is empty. import java.util.ArrayList; public class Test { /** * @param args */ public static void main(String[] args) { // TODO Auto-generated method stub ArrayList lst = new ArrayList(); if(lst != null && lst.size() == 0){ System.out.println("Array list is empty"); } } }


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 can you say empty sets or null sets?

empty set or null set is a set with no element.


What is a empty or null set?

A null or empty set is a set that does not contain any elements.


A criteria that searches for fields that are not empty is called?

A criteria that searches for fields that are not empty is called a "not null" criteria. This criteria is used to filter out records where a specific field does not have a null or empty value.