edited by
546 views
8 votes
8 votes

Consider the following C program fragment:

double a = getMyDouble();
float b, c;
b = getMyFloat();
c = a + b;


If the assembly instruction corresponding to the addition is "ADD R0, R1" where R0 is having the value corresponding to the variable b, the minimum required size in bytes of the register R0 is _____ bytes.

 

edited by

1 Answer

Best answer
9 votes
9 votes
In C language when we do an operation involving operands of different sizes, the smaller one is changed to the larger. So, here even though b is of type float, since addition is done with a double, it also gets converted to a double. So, minimum size required of the register is $8$ bytes.
selected by
Answer:

Related questions

5 votes
5 votes
1 answer
1
gatecse asked Jul 26, 2020
420 views
Which of the following assignments causes an overflow? (Assume size of int is $4$ bytes and long int is $8$ bytes)int a = 123456789;int a = 123456789123456789L;unsigned a...
7 votes
7 votes
3 answers
2
Arjun asked Oct 18, 2016
1,649 views
The output of the following C program will be _____#include<stdio.h #define type int type foo(type b) { return b*b; } #undef type #define type float int main() { float a ...
8 votes
8 votes
2 answers
3
gatecse asked Jul 26, 2020
717 views
The number of characters (including whitespaces if any) printed by the following C program is#define sum(a, b) #a "+"#b "=%d" #include<stdio.h int main() { printf(sum(6,9...
6 votes
6 votes
1 answer
4
gatecse asked Jul 26, 2020
562 views
What will be the output of the following C program?(Assume IEEE -$754$ standard being Used)#include<stdio.h int main() { float a = 8.0625; if(a == 8.0625) { printf("1"); ...