Answered step by step
Verified Expert Solution
Link Copied!

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Relational Database Technology

Authors: Suad Alagic

1st Edition

354096276X, 978-3540962762

More Books

Students also viewed these Databases questions