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
Get step-by-step solutions from verified subject matter experts
