View Single Post
  #1 (permalink)  
Old January 2nd, 2012, 01:19 AM
housecall housecall is offline
Registered User
 
Join Date: Jan 2012
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Question Whether wrong or right, confused????

#include <stdio.h>
#include <conio.h>

void main()
{
int num[10],i;

clrscr();

for (i=0;i<=15;i++)
{
printf("Enter the number : ");
scanf(" %d", &num[i]);
}


for(i=0;i<=15;i++)
{
printf(" %d", num[i]);
}

getch();
}

I ran the above code in Turbo C++ 3.0. The thing that bothering me about this program is that i have declared the size of the array 10 but I can access the index beyond the array's upper bound...I mean how can we access the array beyond its upper bound....it should be an error..but I can comfortably access the array's beyond upper bound..
Please tell me how was i able to access the array's index beyond its upper bound???
Reply With Quote