10 - Parameters and Pointers Flashcards
How does one print the value of a decimal integer?
printf(“%d”,n) in C
push myint //push the value of the variable onto the stack
lea eax,format //address of the format string is saved in eax
push eax //push the address of the string to the stack
call printf //call printf, it will take two parameters from the stack
add esp,8 //clean top two positions in the stack
How does one scan a decimal value ?
scanf(“%d”, &n)
&n is the address of the variable ‘n’
What does %c do in printf?
Print a character
What does %i do in printf?
Print a signed decimal number
What does %s do in printf?
Print a string of characters
What does %c do in scanf?
Read a single character
What does %d do in scanf?
Read a signed decimal integer
What does %s do in scanf?
Read a string of characters until a whitespace char (blank, newline, tab)
What are the two types of jump instructions ?
- Conditional: JCXZ, JECXZ
- Unconditional: JMP <address></address>
JC, JNC ?
JC = Jumps if carry flag is set (=1)
JNC = Jumps if carry flag is clear (=0)