Thursday, September 22, 2011

array property in c and c++

Some characteristics about Arrays
  • The elements of an array are indiced and accessed by their index, where as first position/index of an array starts from "0" and last position is sizeOfArray-1 !! 
  • By default, Arrays are not initialised.
  • Like any other variable, an array must be declared before it is used. 
  • Each element in an Array must be printed individually. 
  • An Array cannot be copied/assigned/compared from another Array directly, these operations have to be done element by element basis. 
  • Name of the Array is nothing but address of/pointer to the first element of the Array 
  • There is no Array bound checking done in C. Trying to access the position at sizeofArray or beyond that is an Error and results in an undefined behaviour.
  • ArrayName indicates the base address or address of the first element in the Array. 
  • Address of any element in a Single Dimensional Array can be caclulated as 
ElementAddress = BaseAddress+ indexOfTheElement * SizeOfTheElement

No comments:

Post a Comment