| | |
@@segmentation fault@@
Please support our C advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Mar 2006
Posts: 4
Reputation:
Solved Threads: 0
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
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
- segmentation fault (C)
- Access Violation (Segmentation Fault) + atol (C++)
- unix/C++ segmentation fault (C++)
- what is the best way to track segmentation fault errors (C++)
Other Threads in the C Forum
- Previous Thread: cin.get problems in use
- Next Thread: C double data type emulation library
| Thread Tools | Search this Thread |
Tag cloud for C
adobe ansi api append array arrays bash binarysearch centimeter char character cm convert copyanyfile copypdffile createcopyoffile createprocess() csyntax directory dynamic execv feet fflush fgets file floatingpointvalidation fork frequency function getlasterror getlogicaldrivestrin givemetehcodez global graphics gtkgcurlcompiling hardware highest homework i/o ide infiniteloop initialization interest intmain() kilometer lazy license linked linkedlist linux linuxsegmentationfault list match matrix meter microsoft multi mysql oddnumber odf open openwebfoundation pattern pause pdf pointer pointers posix power program programming pyramidusingturboccodes read recursion recv recvblocked repetition scheduling segmentationfault send shape single socketprogramming spoonfeeding stack standard strchr string strings structures suggestions system test testautomation unix urboc user voidmain() win32api windows.h






