Click here to Skip to main content
11,644,136 members (72,329 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: C++ C Homework givemecode
I have made this program for my assignment plzz check this and correct the errors i have to submit it latest by 12:00am


struct node
    int element;
    struct node* left;
    struct node* right;
typedef struct node* ptrtonode;
typedef ptrtonode searchtree;
typedef ptrtonode position;
struct treenode
    int Element;
    treenode *Left;
    treenode *Right;
typedef struct treenode *PtrToNode;
typedef struct *PtrToNode searchtree;
typedef struct *PtrToNode Position;
searchtree tree(int x,searchtree T);
void preorder(searchtree T);
searchtree tree(int x,searchtree T);
void preorder(searchtree T);
int main()
    int T=NULL;
    //  freopen("out.txt","w",stdout);
    int  c,i=0;
    int array[100];
    return 0;


searchtree tree(int x,searchtree T)
    //searchtree T;
        T=malloc(sizeof(struct node));
void preorder(searchtree T)
Posted 10-Dec-12 2:55am
Edited 10-Dec-12 4:38am
Alan N at 10-Dec-12 9:01am
Sorry mate you're too late. It's already 1400 here! On a more serious note, why not test your code and see if it performs as expected.
Member 9505466 at 10-Dec-12 9:10am
i tried my best to do plzz help me out of this !
Richard MacCutchan at 10-Dec-12 9:28am
How can we check it when we don't know what it is supposed to do? Try building it so you can at least fix the basic errors.
nv3 at 10-Dec-12 9:29am
If you have already problems with an easy assignment like this, what will you do when you will be working on real software?
Sergey Alexandrovich Kryukov at 10-Dec-12 17:11pm
No; it's not very likely that anyone would look at your code before you explain what you tried to achieve, what it was supposed to do, what did you observer instead and why do you think this behavior is wrong.

Also, did you execute it under debugger?
joshrduncan2012 at 10-Dec-12 9:13am
You need to show some effort as to debugging before we can help you. We will not do the work for you.
OriginalGriff at 10-Dec-12 9:34am
We do not know what it is supposed to do, much less how well it does it!
But, a few quick bits:
1) Take out commented-out code - if it's if not used, it doesn't belong in there.
2) Comment your code! Functions need headers to describe them, and the code within them needs explanation.
3) Don't use single character variable names - use meaningful names that describe what you use the variable for.
4) "else" means just that. So you don't need to say:
if (a == b) { ... }
if (a != b) {...}
because the second condition is implied by the else.
if (a == b) { ... }
else {...}
Is clearer, and less code.
ryanb31 at 10-Dec-12 10:49am
What are the errors?

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Have a lot of problem~~~

check syntax problem at first.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 610
1 484
2 DamithSL 318
3 Afzaal Ahmad Zeeshan 308
4 Sergey Alexandrovich Kryukov 246
0 OriginalGriff 795
1 DamithSL 611
2 Mika Wendelius 494
3 484
4 Afzaal Ahmad Zeeshan 404

Advertise | Privacy | Mobile
Web04 | 2.8.150731.1 | Last Updated 11 Dec 2012
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100