Theory of why this doesn't really work?

Ok, but why then test2 is working?

Also this:

char* test4(unsigned long a)
{
  char s[39];
  snprintf( s, 13, "<%lu>", a );
  return s;
}

It's working, like test2 and test3.