Pink_Flower
Junior Member
- Joined
- Apr 15, 2020
- Member Type
- Student or Learner
- Native Language
- Persian
- Home Country
- Iran
- Current Location
- United States
In this program, our array is of length 5, but we’re trying to write a prime number into the 6th element (index 5). C++ does not do any checking to make sure that your indices are valid for the length of your array. So in the above example, the value of 13 will be inserted into memory where the 6th element would have been had it existed. When this happens, you will get undefined behavior -- For example, this could overwrite the value of another variable, or cause your program to crash.
What does the bold part mean?
Source: https://www.learncpp.com/cpp-tutorial/62-arrays-part-ii/comment-page-5/#comment-465594
What does the bold part mean?
Source: https://www.learncpp.com/cpp-tutorial/62-arrays-part-ii/comment-page-5/#comment-465594