Array Initialization (Valid or In valid) Part - 8

Pubblicato il: 20 dicembre 2018
sul canale di: GOTUTO
98
1

C++ 1D Array Initialization (Valid or In valid) Part - 8
-----------------------------------------------------------------------------------------
Valid or Invalid Array Initialization:
Blog Link: http://gotuto.com/2018/12/06/array-cp...
-----------------------------------------------------------------------------------------
Code Editor: Code::Blocks
download link: http://www.codeblocks.org/downloads/26
-----------------------------------------------------------------------------------------

-----------------------------------------------------------------------------------------
How to initialize an array?
◘ An array is declared it must be initialized.
◘ By Default, it will contain garbage value (any random value).
◘ An array can be initialized in two ways Compile Time &
Runtime

Compile Time Initialization:
Syntax:
data_type array_name [ array_size ] = { list of values } ;

Note: At the time of initialization array_size is optional.

For Example:
int item[5]={12,2,19,9,1};
or
int item[ ]={12,2,19,9,1};

-----------------------------------------------------------------------------------------
What is Array?

Definition:
An array is defined as finite ordered collection of Homogeneous
data, stored in contiguous memory locations.

In Short:

• Finite means: data range (size of array) must be defined

• Homogeneous means: An array is a group or collection of same
data types.

• Ordered means: Stored at contiguous memory locations or
address

• It is a type of data structure

• One-dimensional array is like a list.

• Array name is base address or first element address. Both
addresses are same.


In questa pagina del sito puoi guardare il video online Array Initialization (Valid or In valid) Part - 8 della durata di ore minuti seconda in buona qualità , che l'utente ha caricato GOTUTO 20 dicembre 2018, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 98 volte e gli è piaciuto 1 spettatori. Buona visione!