<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>https://gatecse.in/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Mbkv</id>
		<title>GATECSE - User contributions [en]</title>
		<link rel="self" type="application/atom+xml" href="https://gatecse.in/w/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Mbkv"/>
		<link rel="alternate" type="text/html" href="https://gatecse.in/wiki/Special:Contributions/Mbkv"/>
		<updated>2026-04-16T14:24:24Z</updated>
		<subtitle>User contributions</subtitle>
		<generator>MediaWiki 1.27.0</generator>

	<entry>
		<id>https://gatecse.in/w/index.php?title=Chapter_2:_Data_Types_and_Operators_in_C&amp;diff=4994</id>
		<title>Chapter 2: Data Types and Operators in C</title>
		<link rel="alternate" type="text/html" href="https://gatecse.in/w/index.php?title=Chapter_2:_Data_Types_and_Operators_in_C&amp;diff=4994"/>
				<updated>2015-04-19T10:40:00Z</updated>
		
		<summary type="html">&lt;p&gt;Mbkv: /* Floating Constant */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
&lt;br /&gt;
$C$ is a just a language specification and C compilers (which translates C code to machine code) are made by different organizations/individuals. So, in order to make a C program work across multiple compilers, C standard is important. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
=A little about C standards=&lt;br /&gt;
&amp;lt;timeline&amp;gt;&lt;br /&gt;
ImageSize  = width:1000 height:500&lt;br /&gt;
PlotArea   = left:40 right:0 top:10 bottom:10&lt;br /&gt;
DateFormat = yyyy&lt;br /&gt;
TimeAxis   = orientation:vertical format:yyyy order:reverse&lt;br /&gt;
Period     = from:1965 till:2014&lt;br /&gt;
AlignBars  = early&lt;br /&gt;
ScaleMajor = unit:year increment:5 start:1965&lt;br /&gt;
ScaleMinor = unit:year increment:1 start:1965&lt;br /&gt;
&lt;br /&gt;
Colors =&lt;br /&gt;
  id:gray value:gray(0.7)&lt;br /&gt;
  id:lightsteelblue value:rgb(0.418, 0.609, 0.800)&lt;br /&gt;
&lt;br /&gt;
Define $dx = 20 # shift text to right side of bar&lt;br /&gt;
&lt;br /&gt;
PlotData =&lt;br /&gt;
  bar:event width:20 color:gray shift:($dx,-4)&lt;br /&gt;
&lt;br /&gt;
  from:start till:end color:lightsteelblue&lt;br /&gt;
&lt;br /&gt;
  mark:(line, white)&lt;br /&gt;
  from:1969 till:1973 text: &amp;quot;C language developed by Dennis Ritchie&amp;quot;&lt;br /&gt;
  at:1978 text:&amp;quot;K&amp;amp;R book released, which was used as a reference for C&amp;quot;&lt;br /&gt;
  at:1989 text:&amp;quot;ANSI standard for C (C89) released&amp;quot;&lt;br /&gt;
  at:1990 text:&amp;quot;ISO released C90  (ANSI standard got approved by International Standards Organization (ISO) and got named as C90)&amp;quot;&lt;br /&gt;
  at:1999 text:&amp;quot;C99 released by ISO (A new standard for C which made programming in C a little more easier)&amp;quot;  &lt;br /&gt;
  at:2011 text:&amp;quot;ISO released C11 standard which supports new features which are being given by latest hardware like multi threading, transactional memory etc.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/timeline&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;!--&lt;br /&gt;
&amp;lt;timelinetable title=&amp;quot;Evolution of C&amp;quot; depth=year footer=&amp;quot;C Standards&amp;quot;  headers=Y&amp;gt;&lt;br /&gt;
1969|1973| C language developed by Dennis Ritchie&lt;br /&gt;
1978|1978| K&amp;amp;R book released, which was used as a reference for C&lt;br /&gt;
1989|1989| ANSI standard for C (C89) released&lt;br /&gt;
1990|1990|ISO released C90  (ANSI standard got approved by International Standards Organization (ISO) and got named as C90)&lt;br /&gt;
1999|1999| C99 released by ISO %A new standard for C was released by ISO which made programming in C little more easier }&lt;br /&gt;
2011|2011|  ISO released C11 standard %which supports new features which are being given by latest hardware like multi threading, transactional memory etc.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/timelinetable&amp;gt;&lt;br /&gt;
--&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Till $ANSI$ standard which is almost the same as $C90$ (also  called $C89/C90$) was published, the standard specified in $K\&amp;amp;R$ book was used as a reference for C standard. Each new standard aimed at easing the programming difficulty as well as making use of the new hardware features. We&amp;#039;ll be following as much of $C11$ standard as possible as it adds some significant changes to C language.&lt;br /&gt;
&lt;br /&gt;
=Data types=&lt;br /&gt;
Data types are used to represent data and data comes from real world. In real world we have the following data types&lt;br /&gt;
&lt;br /&gt;
# Integer&lt;br /&gt;
# Character&lt;br /&gt;
# Real Numbers&lt;br /&gt;
&lt;br /&gt;
All other data types can be formed from these basic types (for example, a string is just a sequence of characters). So, in $C$ language we have only these basic types but they are supported in various data sizes as follows&lt;br /&gt;
&lt;br /&gt;
# short int&lt;br /&gt;
# int&lt;br /&gt;
# long int&lt;br /&gt;
# long long int&lt;br /&gt;
# char&lt;br /&gt;
# float&lt;br /&gt;
# double&lt;br /&gt;
# long double&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Now, each of these type is supported in unsigned version also. In signed version, one bit is used to identify if the number is positive or negative. So, for a $32$ bit signed integer, it can represent only up to $2^{31} - 1$, while a $32$ bit unsigned integer can represent up to $2^{32} - 1$.  &lt;br /&gt;
A boolean data type is also present in C standard which can be used to hold a bit. This data type can be used using the keyword $\_Bool$. If we use an $int$ (or $char$), to get a boolean value, we need to logical $AND$ (\&amp;amp;) it with $1$. With $\_Bool$, this conversion is not necessary as the byte representing the boolean will always have the most significant $7$ bits as $0$. &lt;br /&gt;
&lt;br /&gt;
So, let&amp;#039;s see what these data types mean to computer. As we have seen in the previous chapter, all data must be converted into a bit stream before being given to the processor. So, even though we use alphabets and digits while writing programs, they are converted to bits while stored in memory and then given to processor. How many bits a data type takes is defined by the $sizeof$ the data type. In $C$ language, the operator $sizeof$ gives the no. of bytes (i.e., $8$ * no. of bits) a data type takes. Since, memory accesses are restricted to multiple of bytes ($RAM$ doesn&amp;#039;t allow to access data at a granularity lower than 8 bits at a time due to practical reasons) $sizeof$ always return at least $1$ for any data type. (A $\_Bool$ also take a byte of storage as that&amp;#039;s the smallest accessible unit in a memory, though it actually requires just a bit of storage) &lt;br /&gt;
&lt;br /&gt;
Now, lets see the $sizeof$ the various data types in $C$. Since, the data types are directly given to the processor, the $sizeof$ data types depend on the processor architecture. So, $C$ standard just tells the minimum required size specification and have let the compiler designers choose their size as per the processor architecture- $C$ compilers are used for $8$ bit embedded processors to $64$ bit desktop processors. So, this size variation does make sense.&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
! style=&amp;quot;text-align: center;&amp;quot; | Data type&lt;br /&gt;
! style=&amp;quot;text-align: center;&amp;quot; | Min. size &lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot; | char 1&lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot; | 1&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot; | short int 2&lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot; | 2&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot; | int 2&lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot; | 2&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot; | long int 4&lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot; | 4&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot; | long long int 8&lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot; | 8&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot; | ﬂoat 4&lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot; | 4&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot; | double 8&lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot; | 8&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot; | long double&lt;br /&gt;
| style=&amp;quot;text-align: center;&amp;quot; | 10&lt;br /&gt;
|}&lt;br /&gt;
$sizeof$ $char$ is $1$ byte as it was sufficient for $ASCII$ encoding. But for extended $ASCII$ character support, $wchar\_t$ which supports up to $16$ bits is defined in $&amp;lt;stddef.h&amp;gt;$. $C11$ standard also defines $char16\_t$ or $char32\_t$ in $&amp;lt;uchar.h&amp;gt;$ header file thus supporting Unicode characters which requires up to $21$ bits. So, in today&amp;#039;s world, a $char$ and an $int$ take the same size and integer variable ($char32\_t$ of $4$ bytes) is used to store Unicode characters and the data type $char$ is used mainly to refer to a $byte$ of data than an actual character.&lt;br /&gt;
&lt;br /&gt;
=Constants and variables=&lt;br /&gt;
We have seen the data types, but to use them in a program we need to have a variable. A $variable$ is a named entity to represent a specific data type. The type of a variable is fixed during the program run, but its value can be changed, and hence the name variable. (In an object oriented language like $CPP$, a class can be taken as a data type and its instance become a variable). To assign a value to a variable we use $constants$. The following are the example usage of variables and constants.&lt;br /&gt;
&lt;br /&gt;
 int a; // &amp;#039;a&amp;#039; is an int variable&lt;br /&gt;
 a = 5; // 5 is an int constant&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Constant Types==&lt;br /&gt;
In $C$ language we have the following constants&lt;br /&gt;
&lt;br /&gt;
#Integer constant&lt;br /&gt;
## Decimal constant&lt;br /&gt;
## Octal constant&lt;br /&gt;
## Hexadecimal constant&lt;br /&gt;
# Floating constant&lt;br /&gt;
# Character constant&lt;br /&gt;
# Enumeration constant&lt;br /&gt;
&lt;br /&gt;
==Integer Constant==&lt;br /&gt;
C standard supports decimal, octal and hexa-decimal constants being used to assign integer values. Their example usage is as shown below. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot; &amp;gt; &lt;br /&gt;
 #include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
 int main()&lt;br /&gt;
 {&lt;br /&gt;
    enum month{jan = 1, feb, mar, apr, may, jun, july, aug, sep, oct, nov, dec};//jan is having int value 1, feb value 2 and so on &lt;br /&gt;
    int a,b,c; &lt;br /&gt;
    a = 10; //10 is a decimal constant&lt;br /&gt;
    b = 0xa; // a is a hexadecimal constant&lt;br /&gt;
    c = 012; //12 is an octal constant&lt;br /&gt;
    enum month d = oct; //oct is an enumeration constant&lt;br /&gt;
    printf(&amp;quot;a = %d, b = %d, c = %d, d = %d &amp;quot;,a,b,c,d);&lt;br /&gt;
    return 0;&lt;br /&gt;
 }&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;We can use an $int$ instead of $enum$ as both takes same amount of memory. But the use of $enum$ ensures that a variable can hold only a particular set of integer values rather than the whole range of integers. Thus it leads to less program errors and makes the code more readable by providing a set of defined constants&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
Here, $a$ is having the decimal value of $10$. So, in memory $a$ will be like&lt;br /&gt;
&lt;br /&gt;
 000...1010&lt;br /&gt;
&lt;br /&gt;
Similarly, $b$ will be in memory like &lt;br /&gt;
&lt;br /&gt;
 000...1010&lt;br /&gt;
&lt;br /&gt;
and $c$ and $d$ will also be like&lt;br /&gt;
&lt;br /&gt;
 000...1010&lt;br /&gt;
&lt;br /&gt;
i.e.; all $a$, $b$, $c$  and $d$ are having same integer values given using different constants. The memory to be allotted to an integer constant is determined by its value, minimum being the $sizeof(int)$. For example, $40$ is allotted the $sizeof(int)$ while 0xfffffffff is allotted $sizeof(long)$ as it won&amp;#039;t fit in $sizeof(int)$ bytes (assuming $sizeof(int)$ is $4$ and $sizeof(long)$ is $8$).&lt;br /&gt;
&lt;br /&gt;
==Floating Constant==&lt;br /&gt;
To understand clearly floating point conversion, let us do a simple example. It is very clear in decimal number system, a real number can be represented in several ways. $23.75$ for instance is the same as &lt;br /&gt;
* $2375 * 10^-2$&lt;br /&gt;
* $0.2375 * 10^2$&lt;br /&gt;
* $2.375*10^1$&lt;br /&gt;
Of these, the third manner, where the decimal point is placed after the first non-zero number is called the &amp;#039;normalized&amp;#039; notation. If we were to develop a representation for a real number in decimal system, it should allow to represent the sign of the number along with the following details. For example, for the above real number, $2.375$, is known as the significand, $10$ is the base of the decimal number system, and $1$ is the exponent (can also be negative). Please follow Section 4.1 of&lt;br /&gt;
[https://www3.ntu.edu.sg/home/ehchua/programming/java/DataRepresentation.html number represenation] for a clear understanding.&lt;br /&gt;
&lt;br /&gt;
The representation of a floating point number is implementation specific. $C11$ do specifies $IEC$ $60559$ format for floating point representation but its not mandatory that all implementations must support them. But most current implementations do support them and hence it&amp;#039;s good to have a look at them. &lt;br /&gt;
[http://steve.hollasch.net/cgindex/coding/ieeefloat.html  IEEE format]   is a good look as $IEEE$ $754$ is identical to $IEC$ $60559$.  &lt;br /&gt;
&lt;br /&gt;
Constant values can be assigned to float or double variables in various ways as shown below. If a constant cannot be exactly representable in the float or double variable the implementation is recommended to show a warning as per C standard. But this is just a recommendation and not a strict requirement. &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot; &amp;gt;&lt;br /&gt;
 #include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
 int main()&lt;br /&gt;
 {&lt;br /&gt;
    float a = 10.2;&lt;br /&gt;
    float b = 2.3f;&lt;br /&gt;
    double c = 3.4l;&lt;br /&gt;
    double d = 1.2e-3;&lt;br /&gt;
    printf(&amp;quot;a = %.2f, b = %5.2f, c = %05.2lf, d = %le\n&amp;quot;,a,b,c,d); //Just diff format specifiers&lt;br /&gt;
    //%.2f means 2 digits after decimal point will be printed &lt;br /&gt;
    //%5.2f means the output will have a total of minimum 5 places including 2 decimal digits and a point. If lesser digits are there, then the remaining space is filled with white space.&lt;br /&gt;
    //%05.2f is same as %5.2f except that the remaining space, if any, are filled with 0s than white space&lt;br /&gt;
        &lt;br /&gt;
    return 0;&lt;br /&gt;
 }&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Character Constant==&lt;br /&gt;
Characters can be assigned value either by using a character in single quotes or by giving the integer value from the character code. And this int value can be given using hex or octal representation as well, as shown below. Escape sequences are applicable to character constants like $&amp;#039;\backslash n&amp;#039;$, $&amp;#039;\backslash t&amp;#039;$ etc. Character code values can also be used in place of a char by using their octal or hexa-decimal representation. Octal values are given by a preceding &amp;#039;\&amp;#039; where the next three octal digits are converted to the corresponding character. Hexa-decimal codes are given by a preceding &amp;#039;\x&amp;#039; where the next two hexa-decimal digits are converted to the corresponding character.&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;c&amp;quot; &amp;gt;&lt;br /&gt;
 #include &amp;lt;stdio.h&amp;gt;&lt;br /&gt;
 int main()&lt;br /&gt;
 {&lt;br /&gt;
    char a, b, c, d, e;&lt;br /&gt;
    char abc[] = &amp;quot;I \107OT \x49T&amp;quot;; &lt;br /&gt;
    a = &amp;#039;a&amp;#039;;&lt;br /&gt;
    b = &amp;#039;\0&amp;#039;;&lt;br /&gt;
    c = 0;&lt;br /&gt;
    d = &amp;#039;\x41&amp;#039;; //41 is a hexa decimal value whose corresponding ASCII char is assigned to d&lt;br /&gt;
    e = &amp;#039;\101&amp;#039;; //101 is an octal value whose corresponding ASCII char is assigned to e &lt;br /&gt;
    printf(&amp;quot;a = %d, b = %d, c = %d, d = %c e = %c abc = %s\n&amp;quot;,a,b,c,d,e,abc);&lt;br /&gt;
    return 0;&lt;br /&gt;
 }&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here, $a$ is having the $ASCII$ value of $&amp;#039;a&amp;#039;$ which is $97$. So, in memory $a$ will be like&lt;br /&gt;
&lt;br /&gt;
 01100001&lt;br /&gt;
&lt;br /&gt;
Similarly, $b$ and $c$ will be in memory like &lt;br /&gt;
&lt;br /&gt;
 00000000 //ASCII value of \0 is 0&lt;br /&gt;
&lt;br /&gt;
and $d$ and $e$ will be like&lt;br /&gt;
&lt;br /&gt;
 01000001&lt;br /&gt;
&lt;br /&gt;
==Enumeration Constant==&lt;br /&gt;
Enumeration constants are assigned integer values starting from a given initial value which by default is $0$. An example is shown below:&lt;br /&gt;
&lt;br /&gt;
 enum player{ Dhoni = 1, Kohli, Yuvraj, Aswin = 5, Jadeja, Mishra = 10};&lt;br /&gt;
&lt;br /&gt;
Here, Dhoni is having an integer value 1, Kohli 2, Yuvraj 3, Aswin 5, Jadeja 6 and Mishra 10. That is, these names can be used wherever these values are needed.&lt;br /&gt;
&lt;br /&gt;
==String Literal==&lt;br /&gt;
A character string literal is a sequence of zero or more characters enclosed in&lt;br /&gt;
double-quotes, as in &amp;quot;$xyz$&amp;quot;. A $UTF−8$ string literal is the same, except preﬁxed by $u8$.&lt;br /&gt;
A wide string literal is the same, except preﬁxed by the letter $L$, $u$, or $U$. All escape sequences applicable to a character constant is applicable for a string literal except that for $&amp;#039;$ an escape sequence is not mandatory. Any sequence of string literals will be combined into a single string literal during the translation phase of the compiler. Thus, &amp;quot;$abc$&amp;quot; &amp;quot;$de$&amp;quot; is equivalent to &amp;quot;$abcde$&amp;quot;.  Another important property of string literal is that it cannot be modified and is usually stored in the $RO$ Data segment. &lt;br /&gt;
&lt;br /&gt;
 char p[] = &amp;quot;hello world&amp;quot;;&lt;br /&gt;
 char *q = &amp;quot;hello world&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Here, individual characters of p can be modified as the characters of the string literal &amp;quot;hello world&amp;quot; are copied to the memory allocated to $p$ which is $12$ bytes. But, individual characters of the content of $q$ can only be read and not modifiable as $p$ is pointing to a string literal, which is stored in the $RO$ data segment of the program as they are considered as constants. i.e.&lt;br /&gt;
&lt;br /&gt;
 p[2] = &amp;#039;p&amp;#039;; //valid&lt;br /&gt;
 char c = q[2]; //valid&lt;br /&gt;
 q[3] = &amp;#039;q&amp;#039;; //Invalid &lt;br /&gt;
&lt;br /&gt;
The last statement causes  [http://gatecse.in/wiki/Chapter_1#Segmentation_Fault Segmentation fault].&lt;br /&gt;
&lt;br /&gt;
==Implicit Type Conversion==&lt;br /&gt;
We can round off this chapter with an important point about implicit type conversion. Whenever we do an operation with different data types, the lower ranked data type is promoted to the higher ranked one, as, operations are meant to be performed on same types of data. For example when we add an $int$ and a $float$, the $int$ is promoted to $float$ and addition of two $floats$ takes place using two floating point registers. Similarly, when we add a $char$ and an $int$, the $8$ bits of char is made into $32$ bits (assuming $4$ byte size for $int$), by padding it with $0&amp;#039;s$. &lt;br /&gt;
&lt;br /&gt;
One important point about implicit type conversion is that, it depends only on the source operands and is independent of the resultant data type. So, if we multiple two $integers$ and store in a $long$, the result will be calculated as $int$ (usually 4 bytes) and then stored in $long$ (usually 8 bytes). Another common example of this behavior is for division operation. When we divide two $integers$, the result will be $int$ only, even if we assign it to a $float$. So, in these cases the programmer has to explicitly cast one operand to the desired output type. &lt;br /&gt;
&lt;br /&gt;
===What exactly happens during type conversion ===&lt;br /&gt;
&lt;br /&gt;
 &amp;#039;&amp;#039;Before reading the description below, think how it can happen- you won&amp;#039;t think wrong.&amp;#039;&amp;#039;&lt;br /&gt;
&lt;br /&gt;
* $unsigned$ to $signed$ or vice verse: There is no change in the representation in memory. When casting to signed, the most significant bit is taken as a sign bit which would otherwise be used for representing the number. So, this type casting is necessary during conditional checks as a negative number when type casted to unsigned will give a huge $int$ value.&lt;br /&gt;
* $char$ to $int$: If $int$ is $4$ bytes- the top $3$ bytes are filled with sign bit if character is signed and with zero if character is unsigned, and bottom most byte is the same byte used to represent the $char$. The same holds for conversion from $short int$ to $int$ or from $int$ to $long int$&lt;br /&gt;
* $int$ to $char$: Only the lowermost byte of the $int$ is taken and made to a $char$. So, if $int$ value is $511$, its char value will be $255$.&lt;br /&gt;
 00000000 00000000 01111111 11111111 //511&lt;br /&gt;
 //11111111 is 255&lt;br /&gt;
* $int$ to $float$ or $double$: The fixed integer is converted to a representable floating point value. So, this might cause a change to entire bits used to represent the integer.&lt;br /&gt;
* $float$ or $double$ to $int$: The integral part of the floating point value is saved as integer. The decimal part is ignored. For example, $5.9$ will be changed to $5$.&lt;br /&gt;
* $float$ to $double$: The extra mantissa bits supported in $double$ are filled with $0$&amp;#039;s so are the extra exponent bits. The bits of float ($32$ of them) are used without modification.&lt;br /&gt;
* $double$ to $float$: The extra mantissa bits supported in $double$ are truncated in floating representation so do the extra exponent fields. If the truncated exponent field were non zeroes, it might cause a change to other mantissa bits as well as the number would then need an approximation to fit in a float size.&lt;br /&gt;
&lt;br /&gt;
=Exercise Questions=&lt;br /&gt;
{{:C_Questions_on_Datatypes}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{{Template:FBD}}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[Category: Book on C]]&lt;/div&gt;</summary>
		<author><name>Mbkv</name></author>	</entry>

	</feed>