Returning an error in a function
I want to return a string "error" from a function that returns an int on successful completion. How can I do it?
1 2 3 4 5 6 7
|
//like this?
int f() {
if( something_wrong )
throw "error";
else
return some_int;
}
|
Edit: Technically this throws a char*, if you really want a string
throw string("error");
Last edited on
Topic archived. No new replies allowed.