All set! Thanks!
All set! Thanks!
Last edited by raell; 03-07-2004 at 06:26 PM.
>>**node->right = temp;
Try:
>>node->right = temp;
That should get you a little further, how far I don't know
When all else fails, read the instructions.
If you're posting code, use code tags: [code] /* insert code here */ [/code]
Okay, how about posting something that we can compile? As it is you have a super secret header file that defines types and functions. Your formatting is awful. Most notable is that cut/pasted and compiled you seem to be trying to define functions within main. Also, if you are going to mark pieces of code, do so with comments so that we don't have to remove every occurance before getting the code to compile.
Here's a tip. Write a separate program that does the same thing with less fluff. If your problem is with the list then write a bare bones list. This way we don't end up wading through too much unnecessary code to find your problem. Do this and I'll look further than the first include directive.
My best code is written with the delete key.
As I mentioned before, half of this is in FLEX- So it makes it harder for me to explain, but yes I guess that would make them 'super secret header files'. If you want- I can include thatOriginally posted by Prelude
Okay, how about posting something that we can compile? As it is you have a super secret header file that defines types and functions. Your formatting is awful. Most notable is that cut/pasted and compiled you seem to be trying to define functions within main. Also, if you are going to mark pieces of code, do so with comments so that we don't have to remove every occurance before getting the code to compile.
Here's a tip. Write a separate program that does the same thing with less fluff. If your problem is with the list then write a bare bones list. This way we don't end up wading through too much unnecessary code to find your problem. Do this and I'll look further than the first include directive.
part too, I thought it would over complicate things.
My main question is what is incompatible in the statements that I marked off- because they seem like they should work. These are defined and used Only in the C program I included here, so therein lies the problem. I can't see it either, this is my first time using emacs, flex, ssh etc, so I'm a bit confused myself.
>>My main question is what is incompatible in the statements
>>**node->right = temp;
You're trying to dereference the node pointer three times, which is invalid, you can only do it once. The two ways of doing this are:
>>node->right
(like I already showed you)
Or
>>(*node).right
... which is valid syntax, but is simply long hand for the first version.
By doing **node->right, the ** is two deferences, and -> makes a third.
Having said that, the assignment is incorrect anyway, as "right" is a pointer to a struct element, whereas "temp" is a pointer to a struct wordnode.
When all else fails, read the instructions.
If you're posting code, use code tags: [code] /* insert code here */ [/code]
The last bit clears things up.Originally posted by Hammer
>>My main question is what is incompatible in the statements
>>**node->right = temp;
You're trying to dereference the node pointer three times, which is invalid, you can only do it once. The two ways of doing this are:
>>node->right
(like I already showed you)
Or
>>(*node).right
... which is valid syntax, but is simply long hand for the first version.
By doing **node->right, the ** is two deferences, and -> makes a third.
Having said that, the assignment is incorrect anyway, as "right" is a pointer to a struct element, whereas "temp" is a pointer to a struct wordnode.
The only reason the **'s are there is to show you where I'm having issues. It's Not in the code itself.
"right" is a pointer to a struct element, whereas "temp" is a pointer to a struct wordnode. [/QUOTE] -- This is what I was looking for (not how awful my code is formatted), you've answered my question,
thank you!!
>>It's Not in the code itself.
Doh ! Wasted my time there then
I suggest next time you highlight a line, use text that is actually commented out, so that people like me don't get confused! For example:
Code:/* PROBLEM HERE */ temp->left = node; /* PROBLEM HERE */ node->right = temp;
When all else fails, read the instructions.
If you're posting code, use code tags: [code] /* insert code here */ [/code]
Good idea! Thanks againOriginally posted by Hammer
>>It's Not in the code itself.
Doh ! Wasted my time there then
I suggest next time you highlight a line, use text that is actually commented out, so that people like me don't get confused! For example:
Code:/* PROBLEM HERE */ temp->left = node; /* PROBLEM HERE */ node->right = temp;
>If you want- I can include that
Read my second paragraph for details of what you should do to get better help.
>because they seem like they should work
Why do you think so? temp is a pointer to wordnode yet temp->right and temp->left are pointers to element. It's not terribly surprising that you are having issues with assignment.
My best code is written with the delete key.
Originally posted by Prelude
>If you want- I can include that
Read my second paragraph for details of what you should do to get better help.
>because they seem like they should work
Why do you think so? temp is a pointer to wordnode yet temp->right and temp->left are pointers to element. It's not terribly surprising that you are having issues with assignment.
^look up, Hammer called me on that already, That was my problem.
>That was my problem
Yes, I know.
>^look up, Hammer called me on that already
Well, since you're final post said nothing about solving the problem and only mentioned Hammer's suggestion (duplicating mine) to use comments to mark your code, I assumed you still hadn't gotten your answer.
My best code is written with the delete key.