We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
I want to carry out following Hexadecimal Arithmetic operation using C code
Multiplication......................................
char A[2] = { 0x01, 0x02}; char B[2] = { 0x03, 0x04};
I want to carry out multiplication operation and store result in variable C, char C[3] = A * B
I expected the result in C as, C[3] = {0x03, 0x0A, 0x08};
I dont want to use unsigned int or unsigned long variable as i want to extend above mentioned multiplication operation for any size of A and B like A[16] * B[16] = C[32]
Division.............................................. char A[2] = { 0x01, 0x02}; char B[2] = { 0x03, 0x04};
char C[2] = B / A
I expected the result in C as, C[2] = {0x00, 0x02};
Modulus............................................... char A[2] = { 0x01, 0x02}; char B[2] = { 0x03, 0x04};
char C[2] = B % A
I expected the result in C as, C[2] = {0x01, 0x00};
I am looking for some basic C code, so i can quickly adopt same in my application.