Hi All ,
This is my code snippet
typedef struct {
char *name;
} CELL;
typedef struct {
CELL *cell;
char *name;
} INST ;
int main () {
INST **top_inst_list ;
int i,j;
char string_name[100];
printf("Enter number of insts in design\n") ;
scanf("%d",&i);
top_inst_list = (INST **)malloc(sizeof(INST*)*i) ;
for ( j = 0; j < i; j++ ) {
top_inst_list[j] = (INST *)malloc(sizeof(INST));
top_inst_list[j]->name = (char *)malloc (sizeof(char) * 10);
top_inst_list[j]->cell->name = (char *)malloc (sizeof(char) * 5);
}
The last two lines are giving segmentation fault , i have followed this thread (http://www.daniweb.com/software-development/c/threads/147119/page2)
and started this program
Any help regarding this would be helping
Thanks
Nataraja G