int
hwsw famulus
hwsw at famulus.hu
Sun Mar 28 17:07:25 CEST 2004
>Ez miért 0 -t és 1 -et ad vissza..?! Nem 255 -öt és 1 -et kellene?
>unsigned int max_rpm;
>max_rpm = 256;
>printf("0: %3d; 1: %3d",(*(((unsigned char *)&max_rpm)+0)),(*(((unsigned
>char *)&max_rpm)+1)));
256 eseten:
1 0000 0000 +0 = 1 0000 0000 >> 0
1 0000 0000 +1 = 1 0000 0000 >> 1
255 eseten:
1111 1111 +0 =1111 1111 >> 255
1111 1111 +1 =1 0000 0001 >> 1
szerintem.....
Szoval a max_rpm=255 jobb volna, ha nem tevedek valahol, de a
windows kalkultora szerint is igy van :-)
KJ
More information about the Elektro
mailing list