Skip to main content

Posts

Showing posts from September 16, 2016

Array Basic

TOPIC : ARRAY Array is used to store collection of variables of same data type. It may be single dimensional type or multidimensional type.Arrays help a lot ,instead of defining variables again and again , use a single array with multiple variables you want to define. It consists of contiguous memory locations, lowest address corresponds to first element in the array. Single dimensional arrays Syntax: type arrayname[ array size] = {}; Type:  type can be any c++ data type Array size:  array size must be integer constant greater than zero Array name:  valid c++ identifier Example :    int x[1]={10};             ==>  Note:   x is an array of one integer with array size one. Example :    int x[10];                     ==>  Note:   here x is an array of 10 integers                  you can assign integers values to this example through For loop                  for(int i =0 ; i< 10 ; i++)                      {                      x[i]= i + 2;