Hi , I am trying to do a couple of bitwise operations on some hex numbers but for some reason i cant compile. Apparently, it wont be possible with my method:
#include <stdio.h>
float tv,lv;
float nv = 0x01FE;
int main()
{
tv = 0x7FFC;
lv = 0x8000 & tv;
printf("lv = %.02f\n", lv);
if (lv == 0x8000)
{
// number is negative
lv = 0x0000;
printf("lv has been changed to zero");
}
else
{
lv = (nv / tv) * 100;
printf("number is positve lv = %.02f%", lv );
}
}
i get this error :invalid operands to binary & (have ‘int’ and ‘float’)
Please help