Stupid Question....

Why can't I end an IF statement with return 1?

It is saying 1 does not match my function type?
What data type is your function trying to return?
1
2
3
4
5
6
7
8
9
10
11
void func() {
    return 1; //Error, void functions don't return values. Use "return;" instead
}

vector<int> gunk() {
    return 1; //Error, there is no acceptable conversion from int to vector<int>.
}

int main() {
    return 1; //Fine.
}
damn, so simple. I was using void. Thanks for your help.
Just to clarify, return 1 would be ending the entire function, not just the if statement. If you don't know what I mean by this, ask.
Topic archived. No new replies allowed.