In my function I want to return an empty string "", function looks like this:
char *myFunction(nodeType *arg){
if (something){
return anotherFunction(arg);
} else {
return EMPTYSTRING;
}
}
(EMPTYSTRING should be replaced with correct expression to return "")
Some ways I came up with:
return ""
return '\0'
What is the right way to return an empty string?
returnedNULLin place ofEMPTYSTRINGchar *and notconst char *. Just something to be aware of.return ""will give you read-only memory that shouldn't be freed.