Ok, i figured it out. Thanks @TartanLlama for the last comment it makes total sense. So the “core error” (the thing that i wanted to know) was in here:
float /* */ soma_transmissor, soma_recetor;
for(i=0;i<n;i++){
soma_transmissor+=distobj[i];
/* */
}
for(i=n-1,k=n;i>=0;i--){
soma_recetor+=distobj[i+1];
/* */
}
I just needed to inicialize soma_transmissor and soma_recetor. Now if anyone knows why i had to do this to ensure that the correct results appears all the time (when using gcc and not with DevC++) please do share, because I’m completely clueless of the reason. Thanks for all the help.
solved Gcc/G++ doesn’t give correct results when compiling more than 3 times