gcc - Getting number of command line arguments, NASM -


as far know, @ beginning of execution [esp] contains number of command line arguments. i'm doing this:

global main extern printf  section .data format  db  "%d", 0  section .text main:     push format     call printf     add esp, 4      xor eax, eax     ret 

however, prints garbage -145184962. code gives same result:

push dword [esp] push format call printf add esp, 8 

code builded nasm -f elf32 a.asm , gcc -m32 a.o.


Comments

Popular posts from this blog

html - Styling progress bar with inline style -

java - Oracle Sql developer error: could not install some modules -

How to use autoclose brackets in Jupyter notebook? -