The main() function for a small C program is given as int main() { type_1 h = 23
ID: 3651162 • Letter: T
Question
The main() function for a small C program is given as
int main() {
type_1 h = 23;
type_2 k = 56;
printf( "%d ", fun_n(h,k) );
printf( "%d ", fun_m(h,k) );
Determine the data types type 1 and type 2 given the following fragment of the disassembly of main, all optimizations turned off
movb $0x17,0x1d(%esp)
movw $0x38,0x1e(%esp)
movzwl 0x1e(%esp),%edx
movsbl 0x1d(%esp),%eax
Im trying to figure out what to do here, I know that im suppose to return the answer as char, short or long
and signed or unsigned. But I dont know how to use type 1 and type 2 to do this if anyone could help me..
Explanation / Answer
"movb" moves a byte, so "type_1" must be a char "movw" moves a word (two bytes), so "type_2" must be a short. From the code that you've given, these are only being used as unsigned numbers.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.