pmccafferty
Programmer
in my .c file i have a struct atop of the program defined as follows:
with the initial function following it like so:
but I find I receive a Seg-Fault error at
Why does this occur?
Code:
#define MAX 10
int curtab;
static struct tab {
int count;
int use;
} tab[MAX];
with the initial function following it like so:
Code:
int tab_create(int init_count)
{
int i;
for(i=0; i < MAX; i++)
{
if(tab[i].use != 1)
{
tab[i].use = 1; /* true */
tab[i].count = init_count;
curtab = i;
i = MAX; /* break */
}
}
return (curtab);
}
but I find I receive a Seg-Fault error at
Code:
if(tab[i].use != 1)
Why does this occur?