answersLogoWhite

0


Best Answer

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.

User Avatar

Wiki User

14y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is NULL array in C Language?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Why is c string defined as an array?

Every programming language treats strings as arrays. A C string is defined as being a null-terminated array of characters. A C string that does not have a null-terminator is just an array of character values, but without a null-terminator the onus is upon the programmer to keep track of the array's length.


What symbol or character determines end of string?

In C programming language, a string is an array of characters which is always terminated by a NULL character: '\0'


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 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.


How do you use in array?

cod a program student degree array in c language


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.


Why we don't use NULL character in array?

Because it is not a character, it is a pointer. Anyway, the following is perfectly legal: char str [4] = { 'A', 'B', 'C', (char)NULL};


Where string arrays belong in a C program?

There is no data type string in C. String is handled as an array of characters. To identify the end of the string, a null character is put. This is called a null terminated character array. So array of strings will be a double dimensioned array of chars. It is implemented as an array of pointers, each pointer pointing to an array of chars.


What is signifience the name of an array?

The name of an array serves as a reference to the start address of the array and thus to the first element of the array. If the array is fixed length and within the scope of its declaration, the compiler can determine its length from the name alone. However, when an array name is passed to a function, it implicitly converts to a pointer and the size information is lost. thus the size must be passed as a separate argument. The only general purpose exceptions supported by the standard library are null-terminated character arrays (C-style strings) and null-terminated arrays of C-style strings (terminated by a double-null).


How you count lentgh of string without using strlen?

Basically in C language string is NULL (0x00) byte ending char array. So in order to find out the length of the string you need to count all elements in array until you reach NULL. But that is what strlen does. There are two links with information about strlen implementation and null-terminated strings.


Use of gets in c?

Gets reads the next input line into an array ; it replaces the terminating newline with '\0'. it returns the array or null if end of file or error occurs.


How do you write a programme in c language using arrays to copy diagonal elements of a 2-d array into a 1-d array?

TO use a c language first step is to know about the c language and the steps to use the c progrmming language with the help of any elders or with the teachers. TO use the arrays you have to get th eknowledge of "c" language