I think it is weird because for the CreateList, it traverses fine after the program gets the item from the file and added into the list.
Thank you very much for helping and explaining!
I've...
Type: Posts; User: aim4sky
I think it is weird because for the CreateList, it traverses fine after the program gets the item from the file and added into the list.
Thank you very much for helping and explaining!
I've...
Thank you very much!!
Corret me if i'm worng. The following code prints out the address of the pointer?
printf("target = %p\n", (void *) targetnode);
I have it working now. It's time to...
ahh...I have KeyType declared as:
typedef char KeyType;
When I change it to:
typedef char KeyType[MAXCHAR];
Thank you for the help and explanations! Things are a lot clearer now.
TreeSearch():
/* TreeSearch: search for target starting at node root.
* Pre: The tree to which root points has been...
Yes, I forgot to add
return root;
The complier didn't say anything about it. =/
With that been added, the preorder is working now. So this means the items are inserted into the tree. ...
I changed the code to the way you stated and the problems are still there.
When I search for an item that is in the input file, it gives me null.
When I choose preorder, it gives me segmentation...
CreateTree:
/* CreateTree: create a tree.
* Pre: None.
* Post: An empty binary search tree has been created to which root points.
*/
void CreateTree(TreeNode **root)
{
*root =...
Yes it is in the DoCommand(). I also have inorder and postorder in a similiar format to preorder in DoCommand().
When I run the program after reading in the file and choose preorder. It gives me...
I used %s to print out the item's key in string.
Where do I allocate the memory for all cases?
I did think that it was my printing function's problem but it i don't think it's the problem.
printing function:
void Print(TreeEntry x)
{
printf("%s\n", x.key);
}
Hi, I am having a problem with my program. It does not insert anything to the tree. Any help are appreciated. Thanks in advance.
driver:
int main(void)
{
TreeNode *root;
Thank you tabstop and vart for helping!
genlist.h
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "common.h"
#define MAXLIST 300
when I complie the following:
#include "genlist.h"
int main(void)
{
return 0;
}
Thanks! I'll do that now.
The error I am getting is:
cc -c -o radix.o radix.c
In file included from radix.c:12:
queue_linked.h:20: error: storage class specified for parameter âQueueEntryâ
queue_linked.h:23: error:...
It was given.
Thanks! However, it is still producing the same error. =/
I checked common.h. I don't see anything wrong with it. =/
common.h:
//#define DEBUG // turns on debug
// prevents multiple inclusions of header file
#ifndef COMMON_H
Thanks, I'll work on that now and see if it goes away.
The lines that the line numbers are pointing to are in red.
I don't understand what do you mean by hanging off the end of common.h?
common.h is inside the quotation marks.
//prevents...
Hi, I am having this compiling error:
queue_linked.h:18: error: storage class specified for parameter âQueueEntryâ
queue_linked.h:21: error: expected specifier-qualifier-list before âQueueEntryâ...
Referring to #1:
I was looking at other threads, such as:
http://cboard.cprogramming.com/showthread.php?t=100376
it has
currNode = (fileEntry*)malloc(sizeof(fileEntry));
For #3,
The...
First of all, thanks for the replies and help!
I added a copy of the key in the Insert function. I have a warning from compliing.
warning: assignment from incompatible pointer type (the line in...
Hi, thank you for helping.
I allocate the key from fscanf?