I have this one array declared as result[row][col]
the result[row][col] is obtained from the operation of array1[row][col] XOR (^) array2[row][col] where all the arrays contain hexadecimal numbers.
After the result[row][col] is obtained, i want to display it in a form of 4x4 matrix. The function i have written is as follow :
Code:
void display(char result[4][4]){
for(row = 0; row < 4; row ++){
for(col = 0; col < 4; col ++){
printf(" %x ", result[row][col]);}
printf("\n"); }
}
What i get from the display is of course, the expected value, except that it will not display 2 nibbles for a value of zero as its higher nibble.
For e.g :
the results[row][col] is supposedly to have this value :
{ 0xd6, 0xf3, 0x52, 0x04,
0x00, 0x23, 0x5a, 0x53,
0xc1, 0x0f, 0x3f, 0x66,
0xa2, 0x06, 0x55, 0x7c}
I am expecting this to be displayed on the screen :
d6 f3 52 04
00 23 5a 53
c1 0f 3f 66
a2 06 55 7c
However, the actual display i get from the screen is
d6 f3 52 4
0 23 5a 53
c1 f 3f 66
a2 6 55 7c
as you can see, those value with zero as its higher nibble will not be displayed and i dont want that to happens. What i want is to display a fixed 2 nibbles digits regardless its value and i could not find a way to do this. Please helps! Thank you very much!