我试图调用printf打印一个整数一个整数,把它不会打印正确的价值:调用的printf打印
section .data
an: db 1
format: db "num: %d" , 10, 0
section .text
global main
extern printf
main:
push ebp
mov ebp,esp
mov eax, [an]
push eax
push dword format
call printf
add esp, 8
mov esp,ebp
pop ebp
mov eax, 0
ret
这个代码打印“编号:1836412417”
当我尝试打印一个字符它的工作!
section .data
an: db 'a'
format: db "num: %c" , 10, 0
section .text
global main
extern printf
main:
push ebp
mov ebp,esp
mov eax, [an]
push eax
push dword format
call printf
add esp, 8
mov esp,ebp
pop ebp
mov eax, 0
ret
现在它打印 “NUM:一个”?
有啥错的第一个代码!
感谢您的快速响应,解决问题! (Y) – 3la210 2015-03-19 11:13:49