Here is my initiating code:
Code:
#define NUM 20
static struct tab {
int count;
int use;
} tab[NUM];
int curtab = 0;
int tab_create(int tab_count)
{
curtab++;
tab[curtab].use = 1;
tab[curtab].count = tab_count;
kprintf("here!");
return curtab;
}
When I run my program main() which calls intval = tab_create(1); I receive this error
Code:
here!Exception 13 at EIP=00000003: General protection violation
I used GDB for debugging and stepped through the process and received this output:
Code:
main () at prodcons.c:39
39 intval = tab_create(1);
(gdb) s
Program received signal SIGSEGV, Segmentation fault.
0x3 in ?? ()
Any ideas why this is a seg-fault?