C - can't access global variable within user functions
<p>can anyone tell how in C access global variable (in my example it's array 'used') within user functions (in my example it's 'checkData')? it c++ similar code works (but I used 'used = new bool[size];' instead of 'bool used[size];')</p>

<pre><code>#include &lt;stdio.h&gt;
#define true 1
#define false 0

typedef int bool;
bool *used;
int i;

void checkData(int i);

int main ()
{
    int size = 10;

    bool used[size];
    for (i = 0; i &lt; size; i++)
        used[i] = false;

    for (i = 0; i &lt; size; i++)
        checkData(i);

    return 0;
}

void checkData(int i) {
    printf("%d - %d\n", i, used[i]);
}
</code></pre>