Question: Consider the following program. The ASCII code for the character ' 0 ' is 4 8 and for ' 1 ' is 4 9 .

Consider the following program. The ASCII code for the character '0' is 48 and for '1'
is 49.
void f(int a, char res[9]){
int i;
for ( i=7; i >=0; i--){
res[i]= a %2+'0';
a = a >>1;
}
res[8]=0;
}
1. Give the contents of the res array at the end of running f(42, res ).
2. Give a succinct description of what f does.
3. Convert f to assembly language. Assume a is in a0 and the base address of res is in a1. You do not need to save or restore registers.
Consider the following program. The ASCII code

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 Programming Questions!