fprintf printing garbage to txt file : <p>I'm having trouble with strings and c.</p>

<p>I'm trying to do something very simple: converting an int into a string and printing it into a txt file in the following fashion.</p>

<pre><code>const char * test_string() {
    char s[5];
    int num = 123;
    sprintf(s, "%d", num);
    return s;
}

int save() {
    FILE *fh = fopen("test.txt", "w");
    const char * text = test_string();
    fprintf(fh, "%s", text);
    fclose(fh);
}
</code></pre>

<p>Yet, for this simple task, I'm getting the following result:</p>

<pre><code>Üþ(
</code></pre>

<p>I'd like some assistance with this problem. Thanks in advance.</p>
