The first three lines of the program assign values to all nine of the defined variables so we can manipulate some of the data between the different types. Since, as mentioned above, a "char" data type is in reality an "integer" data type, no special considerations need be taken to promote a "char" to an "int" variable. When going the other
way, there is no standard, so you may simply get garbage if the value is within the range of zero to 255.
In the second line therefore, when attempting to set x (a char) to -27, you may or may not get a well defined answer, it depends on your particular implementation of C. The third line illustrates the simplicity of translating an integer into a "float", simply assign it the new value and the system will do the proper conversion. When going the other way however, there is an added complication. Since there may be a fractional part of the floating point number, the system must decide what to do with it. By definition, it will truncate it.
This program produces no output, and we haven’t covered a way to print out "char" and "float"type variables, so you can’t really get in to this program and play with the results, but the next program will cover this for you.
way, there is no standard, so you may simply get garbage if the value is within the range of zero to 255.
In the second line therefore, when attempting to set x (a char) to -27, you may or may not get a well defined answer, it depends on your particular implementation of C. The third line illustrates the simplicity of translating an integer into a "float", simply assign it the new value and the system will do the proper conversion. When going the other way however, there is an added complication. Since there may be a fractional part of the floating point number, the system must decide what to do with it. By definition, it will truncate it.
This program produces no output, and we haven’t covered a way to print out "char" and "float"type variables, so you can’t really get in to this program and play with the results, but the next program will cover this for you.

