Hello. I have a function in assemby that returns an 1 if the numbers are the same and 0 if the numbers are not the same.
I print the variable before the IF clase and Its returning 1 if same and 0 if not same but its always going to the else clause and not the if clause.
This is my C Code.
Code:
void menuSonIgualesFloat(void)
{
int ch;
float f1;
float f2;
printf("--------------------Funcion Son Iguales Float------------------\n");
printf("Entre Primer numero:");
if(scanf("%f",&f1)== 1)
{
printf("Entre Segundo numero:");
if(scanf("%f",&f2) == 1)
{
int y;
y = SonIgualesFloat(&f1, &f2);
printf("Resultado de la funcion es: %d\n", y);
if(y == 1)
{
// ITs not STEPING INTO HERE.
printf(" Los Numeros Son Iguales");
}
else
{
printf(" No Son Iguales");
}
}
else
{
printf("Datos incorrectos");
}
}
else
{
printf("Datos Incorrectos, debe usar el punto para la separacion de decimales");
}
while ( (ch = getchar()) != '\n' && ch != EOF) ;
printf("\n\nPress ENTER to continue.");
while ( (ch = getchar()) != '\n' && ch != EOF)
;
if(ch=='\n' || ch==EOF)
{
printmenu();
}
}
This is my assembly funcion
Code:
SonDiferentesFloat proc var1:REAL4, var2:REAL4
PUBLIC SonIgualesFloat
mov eax, [var1]
mov eax, [eax]
mov ebx, [var2]
mov ebx, [ebx]
cmp eax,ebx
jne theyarenotthesame
;they arent the same
xor eax,eax
ret
theyarenotthesame:
xor eax,eax
inc eax
ret
SonDiferentesFloat endp
end;