C++ Omit Array Size

C++ Omit Array Size


C++ Omit Array Size

Omit Array Size :

In this tutorial you will learn about C++ Omit Array size as follows: You don't have to declare the size of the array. So you declare already big size of array elements that are inserted into it:

int num[] = {34,45,67,65,43}; // size of array is always 4

If you have to declare before extended the size of array , the array will occupies the additional space:

int num[] = {34,45,67,65,43}; // size of array is 6, Therefore only 4 elements inside the array.

Example1: Now you can add a sixth and seventh element without overwriting the others :

 

Output :