breaking out of a void return function

does anyone know how to break out of a function that has a void function? for example,

void insertBST(KeyType k, int lineNum, BST t)
{ PtrToBSTNode p=t->root;
while(p!=NULL)
{ if(strcmp(k, p->key == 0)
InsertLineList(lineNum, p->l); /* <-how can you stop*/
else p=p->right; /* the function here? */
...
}
p->key =malloc(strlen(k));
strcpy(p->key, k);
}

any help would be greatly appreciated. thank you!
-christine

Comments

  • use "return"

    : does anyone know how to break out of a function that has a void function? for example,
    :
    : void insertBST(KeyType k, int lineNum, BST t)
    : { PtrToBSTNode p=t->root;
    : while(p!=NULL)
    : { if(strcmp(k, p->key == 0)
    : InsertLineList(lineNum, p->l); /* <-how can you stop*/
    : else p=p->right; /* the function here? */
    : ...
    : }
    : p->key =malloc(strlen(k));
    : strcpy(p->key, k);
    : }
    :
    : any help would be greatly appreciated. thank you!
    : -christine
    :

  • no dont use return
    you have to use exit(), its included in conio.h i think
  • : no dont use return
    : you have to use exit(), its included in conio.h i think
    :
    Hello,

    exit() will quit the program...And I belive that not what we what here.

    Return will only quit the current function.

    Pat
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories