Please check this code:
extern _printf, _scanf
global _main
section .bss
num1: resb 4
num2: resb 4
section .data
msg1: db "Ingrese un numero: ", 10, 0
msg2: db "Ingrese otro numero: ", 10, 0
fmt_i: db "%i", 0
msg3: db "Los numeros ingresados son: %i y %i", 10, 0
section .text
_main:
sub esp, 8
push msg1
call _printf
add esp, 12
sub esp, 12
push fmt_i
push num1
call _scanf
add esp, 16
ret
The output I get is:
Ingrese un numero: Segmentation fault: 11
I have read Michael Petch(@MichaelPetch)'s great answer about that, but I do not quite understand all that, does anyone have an example code? What's wrong with my code?
Thanks in advance. ^^