0
What does the % in this code mean?
From x[4] = {0,1,2,3} x[i] = i%2 x[1] = 1%2 = 1 How is that possible? I thought % means remainder. How is x[1] = 1?? Correct me if i'm wrong please.
2 Respostas
+ 5
% does means remainder.
If you take a smaller number and divide it by a larger one, say x/y, you'll always get x as the answer for x%y
This is because let's say for 27%100, 100 will go 0 times for 27 that is: 27=(100*0)+27
+ 4
1 divided by 2, is 0 with remainder of 1.