Junior_Muniz Posted October 18, 2016 at 05:22 PM Report #599709 Posted October 18, 2016 at 05:22 PM Meu problema é o seguinte: Quero preencher esse array(String) com os nós da arvore, montando uma estrutura específica. O código até compila mas trava e não mostra o resultado. char *saida(no *arvore, char resultado[]){ String aux; char Ap[2] = "("; char Fp[2] = ")"; strcat(resultado,Ap); sprintf(aux, "%i", arvore->chave); strcat(resultado,aux); sprintf(aux, "%i", arvore->cor); strcat(resultado,aux); if(arvore->esq == NULL){ if(arvore->dir != NULL){ strcat(resultado,Ap); strcat(resultado,"X"); }else{ strcat(resultado,Ap); strcat(resultado,"X"); strcat(resultado,Fp); } }else{ strcat(resultado,saida(arvore->esq,resultado)); } if(arvore->dir == NULL){ if(arvore->esq != NULL){ strcat(resultado,"X"); strcat(resultado,Fp); }else{ strcat(resultado,Ap); strcat(resultado,"X"); strcat(resultado,Fp); } }else{ strcat(resultado,saida(arvore->esq,resultado)); } if(arvore->dir == NULL){ if(arvore->esq != NULL){ strcat(resultado,"X"); strcat(resultado,Fp); }else{ strcat(resultado,Ap); strcat(resultado,"X"); strcat(resultado,Fp); } }else{ strcat(resultado,saida(arvore->dir,resultado)); } strcat(resultado,Fp); return resultado; }
HappyHippyHippo Posted October 18, 2016 at 07:59 PM Report #599712 Posted October 18, 2016 at 07:59 PM vamos ver se consegues descobrir o teu problema em concreto por meias palavras: se eu apresentar o seguinte código, consegues visualizar algum problema ? #include <stdio.h> int main(int argc, char ** argv) { int size_of_string = 2; for (int i = 0; i < size_of_string; i++) { size_of_string = size_of_string + 1; } return 0; } IRC : sim, é algo que ainda existe >> #p@p Portugol Plus
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now