For starters:
Code:
char * foo() {
char temp[20];
return temp;
}
Is just going to crash/segfault your program sooner or later.
As for your real question, there are a few things you can do.
You can have the user pass pointers to the strings you want to return, something like
Code:
void foo(char *retval1, char *retval2)
{
retval1 = some junk;
retval2 = some junk;
}
Then, when your program returns, variables they passed to your function will hold some junk.
Another choice, which probably isn't the best, is using structures.
Code:
struct my2strings
{
char *string1;
cahr *string2;
}
struct my2strings *foo(void)
{
struct my2strings ret = malloc(sizeof(struct my2strings));
ret->string1 = some junk;
ret->string2 = some junk;
return ret;
}
Hope that helps.