|
|
|
=Computer Software Questions=
|
|
|
|
Q:
What do you think can be wrong with this function?
char* NewString(char* string1)
{
int i=0;
char* string2[20];
while (i<19 && *(string1+i) != '\0')
{
string2[i] = toupper (*(string1+i));
++i;
}
string2[i] = '\0';
return string2;
}
A:hint from Hitequest
It is not a good idea to return a pointer to a local var.
|
|
|
|