title: Storage class of referenced memory
body: <p>In C, is it possible to determine the storage class of the memory a pointer points at (e.g., static, heap, stack), portably or nonportably (linux)?</p>
  
  <p>I'd like to be able to do:</p>
  
  <pre><code>switch(storageClass(pointer)){
     case S_STACK:  puts("stack"); break;
     case S_STATIC: puts("static"); break;
     case S_HEAP: puts("heap"); break;
  }
  </code></pre>