473,498 Members | 1,942 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

there is a declaration syntax error in the code i couldn't locate it plz help me find

1 New Member
Expand|Select|Wrap|Line Numbers
  1. #include<stdio.h>
  2. #include<conio.h>
  3. #include<malloc.h>
  4. struct node
  5. {
  6. int info;
  7. struct node*left_child;
  8. struct node*right_child;
  9. };
  10. struct node*create_tree(int,struct node*);
  11. void output(struct node*,int);
  12. struct node*create_tree(int info,struct node *node)
  13. {
  14. if(node==NULL)
  15. {
  16. node=(struct node*)malloc(sizeof(struct node));
  17. node->info=info;
  18. node->left_child=NULL;
  19. node->right_child=NULL;
  20. return(node);
  21. }
  22. if(node->info>=info)
  23. {
  24. node->left_child=create_tree(info,node->left_child);
  25. return(node);
  26. }
  27. else
  28. {
  29. node->right_child=create_tree(info,node->right_child);
  30. return(node);
  31. }
  32. }
  33. void output(struct node*t,int level)
  34. {
  35. int i;
  36. if(t)
  37. {
  38. output(t->right_child,level+1);
  39. printf("\n");
  40. for(i=0;i<level;i++)
  41. {
  42. printf(" ");
  43. printf("%d",t->info);
  44. printf("\n");
  45. output(t->left_child,level+1);
  46. }
  47. }
  48. void main()
  49. {
  50. int info;
  51. char choice;
  52. struct node*t=(struct node*)malloc(sizeof(struct node*));
  53. t=NULL;
  54. printf("\n input choice'b' to break:");
  55. choice=getchar();
  56. while(choice!='b')
  57. {
  58. printf("\n input information of the node:");
  59. scanf("%d",&info);
  60. t=create_tree (info,t);
  61. printf("\n tree is");
  62. output(t,1);
  63. printf("\n input choice 'b' to break:");
  64. choice=getchar();
  65. }
  66. }
Apr 21 '12 #1
1 1393
johny10151981
1,059 Top Contributor
look at output function
combination of curly bracket is not correct. there might be more, but i did't read all
Apr 22 '12 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
3330
by: Steve | last post by:
I just spent waaaaaaaaaaaayy too much time trying to track down an error that was incorrectly reported just now, and I would like to see if someone can explain to me why it was reported that way. ...
29
2477
by: shank | last post by:
1) I'm getting this error: Syntax error (missing operator) in query expression on the below statement. Can I get some advice. 2) I searched ASPFAQ and came up blank. Where can find the "rules"...
5
14559
by: NanQuan | last post by:
I'm hoping someone can help me solve this error since I am at a total loss here. Usually I don't bother posting on any forums or groups on the internet and prefer to solve stuff myself but this is...
0
1259
by: jeffpriz | last post by:
We've got an issue here where we regularly receive an error page with the message "Compiler Error Message: The compiler failed with error code 2000." when we begin debug on our projects. The...
8
46158
by: Wescotte | last post by:
The error message Parse error: syntax error, unexpected $end in FILE on line X is one I run into frequently and I know the cause is I missed an ending quote. Is there an easy way to determine...
7
2174
by: Ray Dillinger | last post by:
Hi. I'm having a problem and I really want to understand it. Here's the situation: I have an array of pointers, and each pointer is the head of a linked list of structs. The structs are...
4
1604
by: muwie | last post by:
I'm failry new to this. I created this script, and first it was working like intended. But then I somehow changed something, and I keep getting this syntax error I type the name of the script ...
6
1046
towsie
by: towsie | last post by:
Hi, I would be very grateful if someone could have a look at the staement below and help me find the Syntax Error. ("Select origin_of_sale as Origin, Category, Crude.F3 as Customer,...
17
3106
by: trose178 | last post by:
Good day all, I am working on a multi-select list box for a standard question checklist database and I am running into a syntax error in the code that I cannot seem to correct. I will also note...
0
7002
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7165
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7203
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7379
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
4908
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4588
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3093
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3081
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
290
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.