C++

Objectives : Importance of null character.

File Name : myArrayNested3.cpp
A null statement is used  in both C/C++.

 

Step: 1 Create two source files, one with "cpp" and other with "c" extensions.

Step: 2 Edit and save Source files.

 

Step: 3 Runtime Views:

a) C null testing :

b) C++ null testing:

Step: Brief Discussion: An array is terminated with a null character. In a loop statement , if we don't capture this endpoint, the system will add some gibberish characters. It happens in both C and C++ languages. In C language, the null character is represented as  '\0', and in C++ the null character is equivalent to numeric zero (0).

In a loop statement, if the number of iteration is more than the length of an array or string, the rest of the space is filled with gibberish characters.