hello everyone. And now that's the problem: When I try to divide an integer by another integer( > 255), the result is 0(zero). The example is: ......... unsigned int result, c; unsigned char a, b; .... a = 3; b = 100; c = 14; result = (256 * a + b) / c; Up to now this code works. If the integer "c" becomes greater than 255 the result is zero. Why? Please send me your opinion. Thanks
You should write like this: unsigned int a; result = (256 * a + b) / c; You defined a,b as char-type,so (256*a+b)is also char-type.A char-type's integer diveded by another integer(>256),the result of cource if 0.