<p>As the title already states, I'm trying to declare a nested function and return a pointer to that function. I want this function 'not' to return a new function pointer which will return the negation of whatever the original function was.</p>

<p>Here is what I have:</p>

<pre><code>someType not( someType original ) {
    int isNot( ListEntry* entry ) {
        return !original( entry );
    }

    someType resultFunc = calloc( 1024, 1 );
    memcpy( resultFunc, &amp;isNot, 1024 );

    return resultFunc;
}
</code></pre>

<p>someType is defined as:</p>

<pre><code>typedef int(*someType)(ListEntry* entry)
</code></pre>

I'm using GCC.
You can turn on nested functions by using the flag:
```
```
-fnested-functions
```
```
when you compile.