As an assignment in school, we have to write a C++ program and returns different error codes in the main
.
The problem is that we have to return -2
if a specific error occurs but I have no idea how to return a negative value.
For example:
int main()
{
int a = -2;
return a;
}
In windows this gives me a return value like: 42232684
and in Linux there is: 253
Why -2
is not allowed?
And how can I manage to get -2
?