Hi, I am trying to implement a crc check but I am not having the correct output. i.e. I am having a "Corrupted file" when the file is not corrupted, and vice versa. I am not "seeing" my mistake since according to me the logic is right. The wierd thing is that before I have implemented the CRC in a function it used to work...now that it is in a function I am having the opposite output. below is my code
before implemented into a function (when it used to work)
P.S adder is the counter of 'corrupted' bits in file.
if (adder != 0)
{
printf("NOT Corrupted");
}
else
{
printf("Corrupted");
}
now that it is in a function (not working)
void CRC(int check)
{
if (check != 0)
{ printf("NOT Corrupted");
}
else
{
printf("Corrupted");
}
// return 0;
}
Thanks a lot.