 <p>While it is acceptable to return pointers to the string literals, buit not to a local pointer, it might be the wrong approach.</p> <p>If <code>str</code> does not change, make it <code>static const char * const str[] = ....</code> That qualifies both, the array and the <code>char []</code> (which is each string literal) it points to const. The <code>static</code> makes it permanent, but with still local scope. It is setup once before your program code starts. In contrast, a non-<code>static</code> version will setup the array for every call.</p> <p>Note that you have to return a <code>const char *</code> to maintain const-correctness. I strongly recommend that; if you cannot, omit the first <code>const</code> only.</p> <p><strong>Note:</strong> Do not cast the result of <code>malloc</code> &amp; friends (or <code>void *</code> in general) in C.</p>