Here are some logical and interesting facts about data-types and the modifiers associated with data-types:-
1. If no data type is given to a variable, then the compiler automatically converted it to int data type.
The size of a is 4 The size of b is 4
2. Signed is the default modifier for char and int data types.
x is -1 and y is -2.
3. We can’t use any modifiers in float data type. If programmer try to use it then compiler automatically give compile time error.
[Error] both 'signed' and 'float' in declaration specifiers [Error] both 'short' and 'float' in declaration specifiers
4. Only the long modifier is allowed in double data types. we cant use any other specifier with double data type. If we try any other specifier then compiler will give compile time error.
[Error] both 'short' and 'double' in declaration specifiers [Error] both 'signed' and 'double' in declaration specifiers
This article is contributed by Bishal Kumar Dubey. If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
- What is size_t data type in C language?
- Different ways to declare variable as constant in C and C++
- Nested functions in C
- Difference between float and double in C/C++
- Character arithmetic in C and C++
- Type Conversion in C
- Storage Classes in C
- Data Types in C
- Structures in C
- Comparison of a float with a value in C
- Integer Promotions in C
- C Language Introduction
- Does overloading work with Inheritance?
- Return values of printf() and scanf() in C/C++
- How to print % using printf()?