@@segmentation fault@@

Please support our C advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: Mar 2006
Posts: 4
Reputation: minorityreport is an unknown quantity at this point 
Solved Threads: 0
minorityreport minorityreport is offline Offline
Newbie Poster

@@segmentation fault@@

 
0
  #1
Mar 12th, 2006
Hello,

i am developing a software for wordCount; i have done all the functions neccessary;

I get segmentation fault when i try and run this :

int main()
{
char* str = (char*)malloc(100);
str[0] = 'T';
str[1] = 'e';
str[2] = 's';
str[3] = 't';
str[4] = 0;

itemType item = buildItem(str);
BSTreeADT treeTest = createBSTree();
treeTest = insertItem(item, treeTest);
displayOccurrences(treeTest);
inOrderTree(treeTest);
printf("%d\n", noOfItems(treeTest));
printf("%d\n", height(treeTest));
printf("%d\n", noOfItems(treeTest));
displayItem(leastItem(treeTest));
//First test all other functions
//then insert/remove some other items and call above functions again
str[0] = 'T';
str[1] = '2';
str[2] = 0; //'\0'
treeTest = insertItem(buildItem(str), treeTest);
}


any ideas?

thanks
Reply With Quote Quick reply to this message  
Join Date: Sep 2004
Posts: 7,804
Reputation: Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute Narue has a reputation beyond repute 
Solved Threads: 747
Team Colleague
Narue's Avatar
Narue Narue is offline Offline
Code Goddess

Re: @@segmentation fault@@

 
0
  #2
Mar 12th, 2006
>any ideas?
Can you narrow it down just a tad? :rolleyes:
I'm here to prove you wrong.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



Tag cloud for C
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC