Can somebody tell me why this code does not work? I tried to compile and run it with gcc 6.3, but the result of the printf is a kind of memory mess: "P@" instead of "something". Compiling it with gcc 5.3 on https://www.jdoodle.com/c-online-compiler, gives me the exact result ("something").
#include <stdio.h>
char *vari;
void foo(char **ts)
{
char buffer[] = "something";
*ts = &buffer[0];
}
int main (void)
{
foo(&vari);
printf("vari: %s\n", vari);
}