The first one is incorrect as you return a pointer that points to nowhere if test is false; it will work reliably if you return NULL
char* myFunction1(boolean test) //Function 1
{
static char variable[10];
if(test)
{
strcpy(variable, "something");
return variable;
}
return NULL;
}
void loop()
{
char *result = myFunction1(false);
if(result == NULL)
{
// no result returned
}
else
{
// result returned
}