For sure it is not.
Let's see the code one more time. I am not going to comment the void main().
/* Function usage starts to execute. (when it gets called from main).
* It needs some space/ memory/ world to live into.
* It allocates its own space, where herself and everything inside her will live.
const char *usage(int test)
/* We declare a local array of 15 chars */
sprintf(s, "%d\n", test);
/* We return the pointer to the local array s */
/* gcc says: (with -Wall flag enabled)
main.c: In function `usage':
main.c:22: warning: function returns address of local variable
/* Function ended its execution, thus ended its lifetime. As a consequence, her
* space/memory/world is no longer nescairy and it gets deallocated. As a result,
* everything inside this world dies, except of static and dynamically allocated
* variables (we do not have any of them here). We have a local variable in the
* function, array s, which dies (goes out of scope).
int a; /* Declare a variable named a, with no initial value */
/* We add 100 to a. But a has not a value. Thus we add 100 in
something we do not know its value and as a result, this
line of code means a = 100 + unknownNumber; */
a += 100;
/* We print where the pointer points to. The pointer is returned
by function usage and when the function was executing, this
pointer, names s, was pointing to a local variable(a local
array to be exact). But the following line is equivalent to
this: const char* sMain = usage(a);
printf("a is %s\n", sMain);
sMain now, points where s was pointing to. s was pointing to
a local variable, which went out of scope (died), when the
function stopped executing. As a result, there is nothing
there. So, sMain points to nothing.
printf("a is %s\n", usage(a));