• 0
Sign in to follow this  

Question

#include <stdlib.h>
#include <stdio.h>
#include <conio.h>
#include <ctype.h>

typedef struct No
{
  int numero;
  struct No *pEsquerda;
  struct No *pDireita;
} No;

void criarArvore(No **pRaiz)
{
*pRaiz = NULL;
}

void inserir(No **pRaiz, int numero)
{
  if(*pRaiz == NULL)
  {
    *pRaiz = (No *) malloc(sizeof(No));
    (*pRaiz)->pEsquerda = NULL;
    (*pRaiz)->pDireita = NULL;
    (*pRaiz)->numero = numero;
  }
  else
  {
    if(numero < (*pRaiz)->numero)
      inserir(&(*pRaiz)->pEsquerda, numero);
    if(numero > (*pRaiz)->numero)
      inserir(&(*pRaiz)->pDireita, numero);
  }
}


int menu(){
	int opcao;
	printf("\n\nO que deseja fazer? \n\n");
	printf("0 - Sair\n");
	printf("1 - Inserir Elementos\n");
	scanf("%d", &opcao);
	return opcao;
}

int main(void){
	
	int opcao;
	criarArvore();
	do {
	opcao = menu();
	switch (opcao) {
	case 0:
	break;
	case 1: 
	inserir();
	break;
	default:
	printf("\nOPCAO INVALIDA!");

}
} 
while (opcao != 0);
return 0;	
}

Iniciei a implementação de inserção de elemento em árvore binária e,

apresentou o seguinte erro:

Linha  Col.                
                In function 'main':
49	2	[Error] too few arguments to function 'criarArvore'
13	6	[Note] declared here
56	2	[Error] too few arguments to function 'inserir'
18	6	[Note] declared here

O que devo fazer?

Edited by rmarquesdm

Share this post


Link to post
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this