Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C++ and Visual C++ > C++ Programming
|
C++ Programming General discussions for the C++ language. For questions specific to Microsoft's Visual C++ variant, see the Visual C++ forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C++ Programming section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old January 2nd, 2012, 01:19 AM
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





Similar Threads
Thread Thread Starter Forum Replies Last Post
Is this worded wrong or am I reading wrong? notig BOOK: Beginning Visual C# 2010 1 September 25th, 2010 01:51 PM
confused about link batuockyo BOOK: Professional CodeIgniter ISBN: 978-0-470-28245-8 0 March 22nd, 2010 12:12 PM
confused mohabedalgani VB.NET 2002/2003 Basics 3 March 30th, 2005 11:48 PM
I'm Confused. Help!!! dangel75 General .NET 1 July 10th, 2004 09:54 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.