Ok im a little lost.. how is sent declared if its just a BNODE.. is it declared in the program or inside that particular function? how do i send it in?
Type: Posts; User: scarlet00014
Ok im a little lost.. how is sent declared if its just a BNODE.. is it declared in the program or inside that particular function? how do i send it in?
like in the actual program? do i send in the sentinel node? or should i send in the sent->next's node
i dont think so.. not really sure
doesnt my insert function do what you are describing in the second part?
what about this for the first part.. this is my find function:
BNODE *tree_find(char *key, void *tree){
BNODE *root...
was asked to do it this way.. :(
I have this binary tree struct declaration:
typedef struct _bnode{
char *name;
int value;
struct _bnode *left; //left child
struct _bnode *right; //right child
struct...
is there anyway to change my bintree library instead of that code? I cant edit that ..
I fixed it thankyou :) ..
Im not getting the segfault anymore but Im getting this output
i wanted it to print in alphabetical order.. so thats right at least..
unix> ./program hey there billy...
I just saw that last post by itcbitc.. lol.. I swear i didnt see it before..
that fixed it..
I get it now lol
Oh ya thats all I want.. I set name in my insert function..
I think so.. well i want it to.. is it not?
I didnt get much help last time I posted this...
please help..
Im having trouble finding what my problem is..
Im writing a binary tree library and when I run this test program: (cannot be...
So what do i do to fix my segfault........
PLease help me...
I added
return new_tree;
So what should I put instead?
Should I just declare the variable and not malloc it?
Im having trouble finding what my problem is..
Im writing a binary tree library and when I run this test program: (cannot be changed)
#include <stdio.h>
#include <stdlib.h>
#include...
I dont really know what im supposed to do here..
I have to pass this print function to another binary tree print function.
I cant change the stuff in red..
void print_name(char *key, void...
yay thankyou so much!
so should i return a bnode at the //do somthing? I had a bnode returning there.. and it gave me an error.. soo... where should i return the bnode?
Im trying to write a binary tree library and this is the only function giving me trouble(so far..)
when i compile, it says:
bintree.c:32: error: void value not ignored as it ought to be...
Im having trouble with this push function.. it says im getting a seg fault and I dont know why..
typedef struct _stacknode{
void *value;
struct _stacknode *next;
struct...
If I have this function..
void push(void *value, void *stack)
{
//code
}
Cool thankyou :) With this, I was able to correct all my other functions too.. except this one .. if I change bool to int it works.. but that shouldnt matter becuase im just returning 1 or 0 right?...
Well what about stack->prev->next... it says that I cant do that.. im thinking bc its a void * and it doesnt really have a prev pointer. how do I type cast or make the void *stack into a STACKNODE...
I really dont understand the typecasting part of this... Im getting alot of errors..
Can anyone tell me why and how I can fix it?
** I have to use the void stars..
typedef struct...
Ive been working on this for days nonstop.. I had no programming knowledge before the begining of september.. so i dont know how to 'focus' on different sections that work off each other... if i was...
I dont understand.. that frees the memory of the old node and then i have nothing to put into the new list...