[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

c question



Hi group,
 
I have constructed the following code:
-----------------------------------------------------------------------------------------------------------------------------
#include "TreeElement.h"
 
struct node
 { TreeElementType elt;
   struct node *left, *right;
 };
typedef struct node Node;
 
typedef Node *Tree;
 
/* Tree Type. */
----------------------------------------------------------------------------------------------------------------------------
typedef char TreeElementType[11];
 
#define TreeElementLess(e1, e2) (strcmp(e1,e2) < 0)
        /* i.e.  e1 < e2 */
 
#define TreeElementMove(e1, e2) (strncpy(*e2, e1, 10))
        /* i.e.  e2=e1 */
 
/* Define Tree of Short Alphanumeric Strings */
---------------------------------------------------------------------------------------------------------------------------
 
#include <stdio.h>
#include "tree.h"
 
void WriteTreeSlave( Tree T, int indent )                         /*L.Allison*/
/* Write a tree, with root at the LHS, by a right-to-left, infix traversal */
 { int i;  char str[]="----------|";
 
   if( T != NULL )
    { WriteTreeSlave(T->right, indent+1);
 
      for(i=0; i < indent; i++) printf("          |");
      sprintf(str, "%s", T->elt);      /* NB. assumed to be a Tree of String */
      i = 0;
      while( str[i] != NULL ) i++;
      while( i < 10 ) { str[i]='-'; i++; }
      str[i] = '|'; str[i+1] = NULL;
      printf("%s\n", str);
 
      WriteTreeSlave(T->left, indent+1);
    }
 }/*WriteTreeSlave*/
 
void WriteTree( Tree T ) { WriteTreeSlave(T, 0); }
 
/* Write a Tree down the page. */
 
int main (){
 WriteTreeSlave("paul",0);
 }
---------------------------------------------------------------------------------------------------------------------------------------------------------------------
It is my goal to call the function "WriteTreeSlave(?,?)"  but I don't know what variables I have to give along with this function (that's why I placed the ?-mark there) . Ik have tried ("paul",0); but that doesn´t work. Can anybody help me?
 
Thanks in advance,
 
Paul Akkermans

Reply to: