This should tell one whether the pointer returned by alloca(3C) is safe to use:<p><pre><code>  #include &lt;sys&#x2F;time.h&gt;
  #include &lt;sys&#x2F;resource.h&gt;
  #include &lt;stdio.h&gt;

  int main(int argc, char *argv[])
  {
    struct rlimit limit;
    getrlimit(RLIMIT_STACK, &amp;limit);

    printf(&quot;Stack start at %p, end at %p.\n&quot;, &amp;argc, &amp;argc - limit.rlim_cur);

    return(0);
  }

  % cc limit.c -o limit &amp;&amp; .&#x2F;limit
  Stack start at 0x7fff51094ba8, end at 0x7fff4f094ba8.
</code></pre>
If the pointer returned by alloca(3C) is within those memory addresses, and does not exceed the bottom (in this example, $7fff4f094ba8), it is safe to use.