View Single Post
Old 05-11-2002, 10:06 PM   #1
visko
Member
 
Join Date: May 2002
Posts: 98
visko is on a distinguished road
Send a message via ICQ to visko Send a message via AIM to visko
I must be insane or stupid, but either way I'm going out of my mind trying to figure out what I'm doing wrong.

I've got a simple little bitty function for creating a series of asterisks, variying by clan rank. The code is as follows:

char *show_rank(CHAR_DATA *ch)
{
int i = 0;
char buf[256];

buf[0] = '[';

if (ch->rank == 0)
{ strcat(buf, "]");
return buf;}

for (i = 1; i <= ch->rank; i++)
strcat(buf, "{R*{x");

strcat(buf, "]");
return buf;
}

I'm getting the following error during compile time:
handler.c:273: warning: function returns address of local variable

Now I understand why this happens, but I can't figure out how to get around it. I haven't dealt much with passing strings between functions, so I'm a bit clueless here. Anyone got a suggestion?

-Visko
visko is offline   Reply With Quote