Hi to all,
i have add some lines code to the file mac802_11.cc in ns2 to display hidden nodes, the code was compiled succefully but after simulating a script.tcl it shows me "Segmentation fault (core dumped)" on terminal
can any one help me
Quote:
void Mac802_11::add_hidden_node(int noeud)
{
if(noeud==index_){printf("\n\n******************************\n\n");
goto il_existe;
}
printf("========%d=====add===> %d\n",index_,noeud);
struct table_n_cach *temp;
struct table_n_cach *table;
if(table==NULL) {
table = (struct table_n_cach*)malloc(sizeof(struct table_n_cach));
table->val = noeud;
table->next = NULL;
goto il_existe;}
else {
if(table->next==NULL)
{
if(table->val==noeud)
{
printf("\n IL EXISTE\n");
goto il_existe;
}
else
{
table->next=(struct table_n_cach*)malloc(sizeof(struct table_n_cach));
table->next->val = noeud;
table->next->next=NULL;
goto il_existe;
}
}
temp = table;
while (temp != NULL)
{
if(temp->val==noeud)
{
printf("\nIL EXISTE\n");
goto il_existe;
}
//printf(" %d\n",temp->val);
temp=temp->next;
}
struct table_n_cach *temp2;
temp2=(struct table_n_cach*)malloc(sizeof(struct table_n_cach));
temp2->val=noeud;
temp2->next = (struct table_n_cach*)malloc(sizeof(struct table_n_cach));
temp2->next=table; table=temp2;
}
il_existe :
//PRINTING
struct table_n_cach *tempR; int i=1;
tempR = (struct table_n_cach*)malloc(sizeof(struct table_n_cach));
tempR = table;
while(tempR!=NULL)
{
printf("|%d %d\n",i,tempR->val); i++; tempR=tempR->next;
}
|