Question: 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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!