0
#include <stdio.h>
#include <stdlib.h>
void recebeNumCartas(int *nAlice, int *nBeatriz){
scanf("%d %d", nAlice, nBeatriz);
}
int achaMenor(int nAlice, int nBeatriz, int menor){
menor = nAlice;
if (nBeatriz < nAlice){
menor = nBeatriz;
}
return menor;
}
int realizaTroca(int nAlice, int nBeatriz, int menor){
int cartasAlice[nAlice];
int cartasBeatriz[nBeatriz];
int troca[menor * 2];
for (int i = 0; i < nAlice; ++i){
scanf("%d", cartasAlice[i]);
}
for (int j = 0; j < nBeatriz; ++j){
scanf("%d", cartasBeatriz[j]);
}
}
int main(void){
int nAlice = 0;
int nBeatriz = 0;
int menor = 0;
recebeNumCartas(&nAlice, &nBeatriz);
menor = achaMenor(nAlice, nBeatriz, menor);
realizaTroca(nAlice, nBeatriz, menor);
getchar();
getchar();
return 0;
}
I am doing an exercise with the above code, but after the first for loop of the performed functionTroca runs the program terminates without any error message. I need help understanding what’s going on.
In which line does this occur? I am half lost
– Guilherme Bartasson
I am still editing the question, I will explain everything that is occurring
– Pilati
you understand what’s happening now?
– Pilati
Got it, I’ll pay more attention to these details, thank you!
– Guilherme Bartasson