Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Comparing function return value in C

Name: Anonymous 2011-05-02 13:10

I was making a program and I noticed that doing
if ((j = function()) == 20)
and
if (function() == 20)
behaved differently. Why is this? What's the difference between one and the other? The first one (the one that has a variable with the function return value) behaved as I thought it would, which is comparing the function return value with the constant. I don't know what the other one does. Thanks.

Name: Anonymous 2011-05-02 13:39

>>5
And this is why mutable state is considered harmful.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List