10 - Parameters and Pointers Flashcards Preview

103: Computer Systems > 10 - Parameters and Pointers > Flashcards

Flashcards in 10 - Parameters and Pointers Deck (10)
Loading flashcards...
1
Q

How does one print the value of a decimal integer?

A

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

2
Q

How does one scan a decimal value ?

A

scanf(“%d”, &n)

&n is the address of the variable ‘n’

3
Q

What does %c do in printf?

A

Print a character

4
Q

What does %i do in printf?

A

Print a signed decimal number

5
Q

What does %s do in printf?

A

Print a string of characters

6
Q

What does %c do in scanf?

A

Read a single character

7
Q

What does %d do in scanf?

A

Read a signed decimal integer

8
Q

What does %s do in scanf?

A

Read a string of characters until a whitespace char (blank, newline, tab)

9
Q

What are the two types of jump instructions ?

A
  • Conditional: JCXZ, JECXZ

- Unconditional: JMP <address></address>

10
Q

JC, JNC ?

A

JC = Jumps if carry flag is set (=1)

JNC = Jumps if carry flag is clear (=0)