Conditional Statement Question

Feb 1, 2013 at 2:53pm
why does the condition of if statement evaluate to true

1
2
3
4
5
6
7
8
#include <iostream>

using namespace std;

int main() {
    if(3)
        cout << "It worked.\n";
} 
Last edited on Feb 1, 2013 at 3:24pm
Feb 1, 2013 at 3:12pm
Any number other than 0 is true.
Feb 1, 2013 at 3:13pm
Thanks. :)
Topic archived. No new replies allowed.