- A1
- B2
- C3 and 4
- DAll
All are valid
Temperature in Fahrenheit is 37.00
The size of an int data type in a 32-bit system is 2 Bytes
Output:
-56
char has lesser bytes than int and int has lesser bytes than double in any system
Option C is correct with respect to the size of the datatypes in the C programming language. The char data type typically has a size of 1 byte, the int data type typically has a size of 4 bytes, and the double data type typically has a size of 8 bytes. Therefore, char < int < double in terms of size. However, it's worth noting that the size of these data types can vary depending on the specific implementation and architecture of the system being used.
In C language, data types can be arranged based on their size in bytes. Here's a common arrangement from smallest to largest:
Please note that the actual size of these data types might vary depending on the compiler and system architecture.
Output:
8
Default data type of signed, unsigned is int. In 64-bit machine size of int is 4 byte.
signed=4
unsigned=4
Then, 4+4=8
Consider on the expression:
x = 10 +- 10u + 10u +- 10;
10: It is signed integer constant.
10u: It is unsigned integer constant.
X: It is signed integer variable.
In any binary operation of dissimilar data type for example: a + b
Lower data type operand always automatically type cast into the operand of higher data type before performing the operation and result will be higher data type.
As we know operators enjoy higher precedence than binary operators. So our expression is:
x = 10 + (-10u) + 10u + (-10);
= 10 + -10 + 10 + (-10);
= 0
Note: Signed is higher data type than unsigned int.
So, Corresponding signed value of unsigned 10u is +10
By default floating constant is of a double data type. By suffixing it with f or F, it can be converted to float data type. For more details, this post can be referred here.
In C, when an integer value is compared with an unsigned it, the int is promoted to unsigned. Negative numbers are stored in 2's complement form and unsigned value of the 2's complement form is much higher than the sizeof int.