I always get confused with while when I need to use multiple condition. I believe this is correct.
1 and 1 = 1
1 and 0 = 0
1 or 1 = 1
1 or 0 = 1
Is there something special I need to do with while loops? If statements always seem to behave like I expect with multiple conditions. Is there a good rule of thumb to follow?
Like here. Since I usually try || and it never seems to work I used && first. But Of course I needed an || in this case just because I did the opposite of what I usually do.
const char *s = buffer;
parser_comment_level = 0
while (ispunct((unsigned char)*s) || parser_comment_level != 0)
{
}
I would like to change the above to. Is that correct or do I need to use an &&? Would it be a good idea to use parenthesis and if so how?
const char *s = buffer;
parser_comment_level = 0
while (ispunct((unsigned char)*s) || parser_comment_level != 0 || (unsigned char)*s != '\0')
{
}