LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-18-2014, 02:40 PM   #1
mezyana
LQ Newbie
 
Registered: Apr 2014
Posts: 4

Rep: Reputation: Disabled
Segmentation fault (core dumped)


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;
}
 
Old 05-18-2014, 03:52 PM   #2
dijetlo
Senior Member
 
Registered: Jan 2009
Location: RHELtopia....
Distribution: Solaris 11.2/Slackware/RHEL/
Posts: 1,491
Blog Entries: 2

Rep: Reputation: Disabled
Sounds like an error trapping problem.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Segmentation fault (Core dumped) ramshank Linux - Newbie 4 04-24-2014 02:35 AM
Segmentation fault (core dumped) Khaled ELmishad Programming 1 06-16-2012 11:13 AM
Segmentation fault (core dumped) nasim751 Programming 2 01-28-2008 02:56 PM
Segmentation fault (core dumped) plisken Linux - General 8 09-17-2003 03:32 AM
Segmentation fault (core dumped) hasanaydin Linux - General 0 03-27-2002 07:47 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:07 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration