2nd Apr 2022, 4:23 PM
Heera Singh Lodhi
1 Answer
0
Heera Singh Lodhi look closely at your inner loop. It accesses memory outside the array upper bound. Observe, when j is n-1 (the highest index that is within the array bound), the statements access arr[j+1], which is arr[n] and out of bounds. for(j=0; j<n; j++){ if(arr[j] > arr[j+1]){
3rd Apr 2022, 4:09 AM
Brian
Brian - avatar