[ad_1]
s is a local variable that only exists within the function.
Once the function exits, s no longer exists, and its memory will be re-allocated to other parts of your program.
Therefore, your function is returning a pointer to a random meaningless block of memory.
2
[ad_2]
solved Why should a function not return a local array? [duplicate]