Last active
September 7, 2017 19:50
-
-
Save orgads/0f8dcec8afa734f46527bc6dee726de8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| int test(bool condition) | |
| { | |
| int Arr1[3] = {0}; | |
| int Arr2[6] = {0}; | |
| int *Arr; | |
| int ArrSize; | |
| if (condition) | |
| { | |
| Arr = Arr1; | |
| ArrSize = 3; | |
| } | |
| else | |
| { | |
| Arr = Arr2; | |
| ArrSize = 6; | |
| } | |
| return Arr[ArrSize-1]; // error: Cppcheck(arrayIndexOutOfBounds): Array 'Arr1[3]' accessed at index 5, which is out of bounds. | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment