Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Given the following C code: void swap( int x, int y ){ int t= x; x= y; y= t; } int main(){ int a= 10;
Given the following C code:
void swap( int x, int y ){ int t= x; x= y; y= t; } int main(){ int a= 10; int b= 20; swap( a, b ); printf( "a = %d, b = %d ", a, b ); }
Part 1:
What will the printf function output as the value of variable 'a'? ANSWER IN DECIMAL!!! DO NOT INCLUDE THE TEXT OF THE PRINTF STATEMENT, JUST THE VALUE OF VARIABLE 'a' THAT IS OUTPUT!!!!!!
Part 2:
True or false: Assuming that the first parameter is in %rdi and the second parameter is in %rsi, the following assembly is produced when the swap function is compiled:
movl (%rdi),%eax movl (%rsi),%edx movl %edx,(%rdi) movl %eax,(%rsi) retq
ANSWER ONLY 'TRUE' OR 'FALSE'
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started