Logical value of an assignment in C

Posted by Andy Shulman on Stack Overflow See other posts from Stack Overflow or by Andy Shulman
Published on 2009-12-02T08:40:42Z Indexed on 2010/04/04 16:53 UTC
Read the original article Hit count: 204

while (curr_data[1] != (unsigned int)NULL &&
    ((curr_ptr = (void*)curr_data[1]) || 1))

Two part question.

What will (curr_ptr = (void*)curr_data[1]) evaluate to, logically. TRUE?

Also, I know its rather hack-ish, but is the while statement legal C? I would have to go through great contortions to put the assignment elsewhere in the code, so I'd be really nice if I could leave it there, but if it's so egregious that it makes everyone's eyeballs burst into flames, I'll change it.

© Stack Overflow or respective owner

Related posts about logical-operators

Related posts about c