|
-
April 22nd, 2004, 12:06 PM
#4
The "Even" in the second if statement points to the function bool Even( int ); which always exist so is always true.
The reason for this is that the scope for the variable "bool Even" is inside of the first if statement. It will only be instantiated and then destroyed when and if the number to be tested is even.
So by the time it gets to the second if statement, the "bool Even" variable doesn't exist anymore.
And if the number to be tested is false, well "bool Even" variable would never have been created.
Last edited by smakadia; April 22nd, 2004 at 12:08 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|