Monday, February 9, 2009

Data Type Mixing

It would be profitable at this time to discuss the way C handles the two types "char" and "int".
Most functions in C that are designed to operate with integer type variables will work equally
well with character type variables because they are a form of an integer variable. Those functions,
when called on to use a "char" type variable, will actually promote the "char" data into integer
data before using it. For this reason, it is possible to mix "char" and "int" type variables in nearly
any way you desire. The compiler will not get confused, but you might. It is good not to rely
on this too much, but to carefully use only the proper types of data where they should be used.
The second new data type is the "float" type of data, commonly called floating point data. This
is a data type which usually has a very large range, a large number of significant digits, and a
large number of computer words are required to store it. The "float" data type has a decimal
point associated with it and, on most computers, has an allowable range of from 10-38 to 10+38.
Not all compilers have the same available range, so check your reference manual for the limits
on your compiler.

Google Search

Custom Search