We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
This code will compile and run because c++ doesn't do bound checks on arrays. However you're accessing unknow memory in your code.
for(inti=0;i<n;i++){for(intk=i+1;k<n;k++){/*a[k] access unknown memory when "i = n-1". undefined behavior. It just happen to work in this instance.**/if((a[i]+a[k])%l==0&&i<k)count++;}}
Divisible Sum Pairs
You are viewing a single comment's thread. Return to all comments →
This code will compile and run because c++ doesn't do bound checks on arrays. However you're accessing unknow memory in your code.