Returning a NULL string, Crashes compiler?
#1

Hey, a simple question this time, I've never used this method while coding before so I'm not sure how to workaround this:

Say you have a function that returns 0 if it fails:

Code:
func(something)
{
    if(something == somethingelse) return 5;
    return 0;
}
So I did the same thing with a string:


Code:
func(something)
{
    if(something == somethingelse) return somestring;
    return "";
}
This crashes the compiler and so does this:
Code:
func(something)
{
    if(something == somethingelse) return somestring;
    return "<NULL>";
}
I never knew you couldn't return strings like return "this";




So now I'm at a loss and don't know what to return at the end, I can't return nothing because I get a 'must return something' error.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)