Displaying the value to which a pointer referred in the local function makes sense for me, calling this local function in the main function, the value to which the pointer refered changed.
#include<stdio.h>
char *getAnotherString(){
    char target[] = "Hi, ComplicatedPhenomenon";
    char *ptrToTarget = target;
    printf("ptrToTarget                 = %p\n", ptrToTarget);
    printf("ptrToTarget                 = %s\n", ptrToTarget);
    return ptrToTarget;
}
int main(){
    char *ptrToTarget = NULL;
    ptrToTarget = getAnotherString();
    printf("ptrToTarget                 = %p\n", ptrToTarget);
    printf("ptrToTarget                 = %s\n", ptrToTarget);
    return 0;
}
I expected the output like
ptrToTarget                 = 0x7ffeeed1c950
ptrToTarget                 = Hi, ComplicatedPhenomenon
ptrToTarget                 = 0x7ffeeed1c950
ptrToTarget                 = Hi, ComplicatedPhenomenon
the actual output is
ptrToTarget                 = 0x7ffeeed1c950
ptrToTarget                 = Hi, ComplicatedPhenomenon
ptrToTarget                 = 0x7ffeeed1c950
ptrToTarget                 = Hi, ComplicatedP
 
     
    