title: Is there a a way to achieve closures in C
body: <p>I would like this to work, but it does not:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  typedef struct closure_s {
    void (*incrementer) ();
    void (*emitter) ();
  } closure;
  
  closure emit(int in) {
  
    void incrementer() {
      in++;
    }
  
    void emitter() {
      printf("%d\n", in);
    }
  
    return (closure) {
      incrementer,
      emitter
    };
  }
  
  main() {
    closure test[] = {
      emit(10),
      emit(20)
    };
  
    test[0] . incrementer();
    test[1] . incrementer();
  
    test[0] . emitter();
    test[1] . emitter();
  }
  </code></pre>
  
  <p>It actually <em>does</em> compile and does work for 1 instance ... but the second one fails.  Any idea how to get closures in C?</p>
  
  <p>It would be truly awesome!</p>