Files
college-C/13 - Bits/ex3.c
2022-02-25 15:33:16 +02:00

20 lines
344 B
C

#include "PointersLibs.h"
BOOLEAN EvenBits(byte b)
{
BOOLEAN even = TRUE;
unsigned short loop_length;
for (loop_length = sizeof(b) * EIGHT; loop_length; loop_length--)
{
even ^= b & MASK_FIRST_BIT;
b >>= ONE;
}
return (even);
}
void main(void)
{
byte b = 3;
printf("%hu\n", EvenBits(b));
}