suppose i declare an array of size 10(a[10]) and i try to use even 11th or 12th element...that is i try to put some data...and later extract from a[10] or a[11] ..is it possible..ans with respect to both c and c++..
mayankjain05
0
Newbie Poster
Recommended Answers
Jump to PostIt sure is possible, since C/C++ offers no built-in bounds checking. The 11th and 12th elements will refer to the memory location of the array (a) + 10 and + 11 respectively. What is in those memory locations would be difficult to say, and would be implementation specific. You could …
Jump to PostMore than likely, your program will terminate immediately. Sometimes it will keep going, overwriting memory that you're not supposed to will almost certainly cause your program to malfunction somewhere later. My advice is that you're not supposed to do it.
All 6 Replies
nmaillet
97
Posting Whiz in Training
Tumlee
42
Junior Poster in Training
mayankjain05
0
Newbie Poster
deceptikon
1,790
Code Sniper
Team Colleague
Featured Poster
Moschops
683
Practically a Master Poster
Featured Poster
mayankjain05
0
Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.