What will be the output of the following C code? [code]Maximum value of int = 1000 Maximum value of float = 5000 Maximum value of short

What will be the output of the following C code?
Code:
Maximum value of int  =  1000
Maximum value of float = 5000
Maximum value of short int = 327
Minimum value of short int = -328
#include<stdio.h>
#include<limits.h>
#include<float.h>
main()
{
    short int d;
    d=INT_MAX + FLT_MAX;
    printf("%d",d);
}
A. error
B. 6000
C. 327
D. -328
 
Answer: c
Explanation: Since the data type in which we store the result of the expression INT_MAX + FLT_MAX is of the type short int, the output of the code shown above will be the maximum of short int. Hence the output is 327.
 

Tìm kiếm

Back
Top