Program to illustrates Array Index out of Bounds



#include<iostream.h>
#include<conio.h>

void main( )
{
    const int SIZE = 4;
    float A[SIZE]= { 22.22, 44.40, 12.13, 14.15 };
    clrscr();
    for(int i = 0; i<7;i++)         //ERROR : index is out of bounds !
      cout<<"\t A["<<i<<" ] = " << A[i]<<endl;
    getch();
}

0 comments:

Post a Comment

 
 
 
 


Copyright © 2012 http://codeprecisely.blogspot.com. All rights reserved |Term of Use and Policies|