The following is the code which I typed in c
unsigned long long int Je=23;
int col=2,row=2;
void mod(unsigned long long int mat1[][col],unsigned long long int mat2[][col],int r)
{
int i,j;
for(i=0;i<r;i++)
for(j=0;j<col;j++)
{
mat1[i][j]=mat2[i][j]%Je;
printf("Value mat1=%u mat2=%u Je=%u\n",mat1[i][j],mat2[i][j],Je);
}
}
I call this function with the following matrix
t1[2][2]={1036,1090,1526,1472};
mod(t2,t1,row);
But in the console screen I get the following results for the "printf" statement I included inside the function definition
Value mat1=5 mat2=0 Je=1036
Value mat1=2 mat2=0 Je=1090
Value mat1=16 mat2=0 Je=1526
Value mat1=9 mat2=0 Je=1472
How come the values are printed like this? I am using Dev Cpp compiler.
The format specifiers "%u" in the printf statement are incorrect. For an unsigned long long, the specifier should be "%llu"