home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c
- Path: sparky!uunet!ferkel.ucsb.edu!taco!rock!stanford.edu!ames!sun-barr!cs.utexas.edu!sdd.hp.com!ux1.cso.uiuc.edu!cs.uiuc.edu!sparc0b!ctaylor
- From: ctaylor@cs.uiuc.edu (Conrad Taylor)
- Subject: What should be returned by the functions...???
- Message-ID: <BzKoIM.L3@cs.uiuc.edu>
- Sender: news@cs.uiuc.edu
- Organization: University of Illinois at Urbana-Champaign
- Date: Sun, 20 Dec 1992 19:23:09 GMT
- Lines: 59
-
-
- What should the functions , insertright and insertleft, return because
- I'm receiving errors with Borland C++ 3.1. For exmaple, functions isn't
- returning a value. Thanks in advance to all that reply.
-
- -Con
-
- ps: My e-mail is ctaylor@silver.lcs.mit.edu or
- taylor1@wse.eecs.uic.edu.
-
-
- struct node {
- int info;
- struct node *left;
- struct node *right;
- };
-
- typedef struct node *NODEPTR;
-
- NODEPTR insertright(NODEPTR p, int x); /* ins immediately to right of header */
- NODEPTR insertleft(NODEPTR p, int x); /* ins to the left of header */
-
- NODEPTR insertright(NODEPTR p, int x)
- {
- NODEPTR q, r;
-
- if (p == NULL) {
- printf("void insertion\n");
- return;
- } /* end if */
- q = getnode();
- q->info = x;
- r = p->right;
- r->left = q;
- q->right = r;
- q->left = p;
- p->right = q;
- return;
- } /* end insertright */
-
- NODEPTR insertleft(NODEPTR p, int x)
- {
- NODEPTR q, r;
-
- if (p == NULL) {
- printf("void insertion\n");
- return;
- } /* end if */
- q = getnode();
- q->info = x;
- r = p->left;
- r->right = q;
- q->left = r;
- q->right = p;
- p->left = q;
- return;
- } /* end insertleft */
-
-
-