944,020 Members | Top Members by Rank

Ad:
  • C Discussion Thread
  • Unsolved
  • Views: 1135
  • C RSS
Mar 12th, 2006
0

@@segmentation fault@@

Expand Post »
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
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
minorityreport is offline Offline
4 posts
since Mar 2006
Mar 12th, 2006
0

Re: @@segmentation fault@@

>any ideas?
Can you narrow it down just a tad? :rolleyes:
Administrator
Reputation Points: 6442
Solved Threads: 1393
Bad Cop
Narue is offline Offline
11,807 posts
since Sep 2004

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C Forum Timeline: cin.get problems in use
Next Thread in C Forum Timeline: C double data type emulation library





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC