This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

multipy function

Hi All
I am trying multipy function.After compliering, the a value is 0x78H, b is 0x02H. So, if I want addition function d=a+b(0x78+0x02H)to next line, how define variable a,b to get through with my request.

void main(void)
{
while(1){
char a,b,c,d;
a=0x9e;
b=0x04;
c=a*b; //a=0x78 b=0x02
d=a+b; //this line is 0x9e+0x04
}
}

Parents
  • After compliering, the a value is 0x78H, b is 0x02H.

    How did you determine these numbers? Are you sure you weren't looking at the CPU registers A and B, rather than your variables a and b?

    You may want to re-think using 'a', 'b' and 'c' as variable names if you're compiling in the default case-insensitive mode.

Reply
  • After compliering, the a value is 0x78H, b is 0x02H.

    How did you determine these numbers? Are you sure you weren't looking at the CPU registers A and B, rather than your variables a and b?

    You may want to re-think using 'a', 'b' and 'c' as variable names if you're compiling in the default case-insensitive mode.

Children
No data