I'm trying to create an upper case method(i can't use it from library cause my software doesn't support it). The problem is that when i use my method in my output have always the last result from my strings. I can't really understand where exactly is the problem. I believe that i don't handle pointers with right way.
Here is an example:
Into initialize :
char *Register[5];
Inside my while :
char *p;
int i =0;
for(i=0;i<=4;i++)
{
    if(i==0)p="test1";
    if(i==1)p="test2";
    if(i==2)p="test3";
    if(i==3)p="test4";
    Register[i]=ToUpper(p);
}
Eusart2_Write(Register[0]);
__delay_ms(20);
Eusart2_Write(Register[1]);
__delay_ms(20);
Eusart2_Write(Register[2]);
__delay_ms(20);
Eusart2_Write(Register[3]);
And here is my upper method :
char *ToUpper(char *string)
{
    int i=0;
    char txt[255]="";
    char Buffer[255]="";
    strcpy(Buffer,string);
    for(i = 0; i<=strlen(Buffer); i++)
    {
        if(( Buffer[i]>='a')&&( Buffer[i]<='z'))
            txt[i]=Buffer[i] - 32; 
        else
            txt[i]= Buffer[i];  
    }
    txt[i++]='\0';
    return txt;
}
In my output I'm taking the same result for all registers :
TEST4TEST4TEST4TEST4
 
     
    