Video Games Homepage
Porsche Service Bulletins Info Index Book Brochure 2000

Porsche Service Bulletins Info Inde..

Scotland Genealogy Index Of Deaths 1 Set  8 Fiche

Scotland Genealogy Index Of Deaths..

US $7.35

Bob Meusel 1927 Yankees Index Card Signed Jsa

Bob Meusel 1927 Yankees Index Card ..

US $49.99

Dennis Dugan Hand Signed 3x5 Index Card Actordirector

Dennis Dugan Hand Signed 3x5 Index ..

US $0.99

Tom Hamilton Hand Signed 3x5 Index Card Rear Adm Fb

Tom Hamilton Hand Signed 3x5 Index ..

US $0.99

New Copag Poker Size Jumbo Index  Bluered Setup

New Copag Poker Size Jumbo Index ..

US $12.99

Rb Stax William Bell Signed Matted Index Card Coa 8x10

R b Stax William Bell Signed Matted..

US $75.00


Video Games Homepage

Reliable video games information

Burnham Index Arch Lit Art Inst O Very Good Book
US $75.00
Porsche Service Bulletins Info Index Book Brochure 2000
US $9.99

Why does the following code not return an index out of bounds error? (c++)?

Question: Why does the following code not return an index out of bounds error? (c++)?

(Posted by: floyd t on 2010-01-25 23:16:40)

Void main(){ char a[10]= "hello "; cout < <a[17] < <endl; }


Answers:

Posted by: Pete S on 2010-01-25, 23:24:32

C+ + isn't like Java, there isn't much built in Exception checking. So typically the variable a gets declared on the stack, which is a specified size for your program. As long as you don't get to some point outside of your program's allocated memory space from the operating system, C+ + isn't going to stop you. In this case, you're just accessing some other memory in your program, probably in its stack space, which doesn't cause a major problem. The code of course is still wrong, but C+ + isn't going to keep you from shooting yourself in the foot unlike Java and other languages.

  

Posted by: Paul on 2010-01-26, 01:23:30

There is no array bounds checking in C or C+ + . You would need a language like Pascal for that. Also note that "void main " is illegal.

  

Powered by Yahoo! Answers®


Back to Previous page

Bookmark Video Games Homepage

Sitemap | Terms of Use | Privacy Policy | Contact

© copyright 2008 www.gamesmaniaonline.com, All Rights Reserved.

Legal Notice: This website is powered by Amazon®, Adsense™, Ebay®, Yahoo!® Answers and Youtube™. All trademarks are copyrighted by their respective owners. Please read our terms of use and privacy policy.