Sujet : Re: if(!(i%16))
De : fir (at) *nospam* grunge.pl (fir)
Groupes : comp.lang.cDate : 31. Mar 2024, 00:49:59
Autres entêtes
Organisation : i2pn2 (i2pn.org)
Message-ID : <uua4uh$3irjh$1@i2pn2.org>
References : 1 2
User-Agent : Mozilla/5.0 (Windows NT 5.1; rv:27.0) Gecko/20100101 Firefox/27.0 SeaMonkey/2.24
bart wrote:
On 30/03/2024 21:44, fir wrote:
void bytes_dump_in_hex()
{
for(int i=0; i<bytes_size; i++)
{
if(!(i%16)) printf("\n");
>
printf("%02x ", bytes[i]);
}
}
>
in the code above seem that those inner () in if(!(i%16)) are needed
>
why is that so?
>
Without them !i%16 will be parsed as (!i)%16.
>
and does it have sense?
if ! is boolean operator and % is arithmetic then converting things to bolean and then do arithmetoc on it seems not much reasonable...
overally isnt arithmetoc stronger than boolean like a*b < c*d ?