#include <stdio.h>
int main()
{
unsigned int a=10;
int b=10;
int c=-1;
printf("%d %d %d",(c%a),(c%(int)a),(c%b));
return 0;
}
Outputs "5 -1 -1" (using https://www.onlinegdb.com/). What is it calculating to arrive at 5? And is just casting the unsigned int to int the correct fix as long as it fits in an int?