Explore BrainMass

Implicit constructors in C

How C supports implicit constructors. Compare this C feature with other languages. How reliable is this feature.

Solution Preview

How C supports implicit constructors

When executing assignment statements and performing calculations, data types may be temporarily or permanently converted to other data types. Implicit conversions take place without the programmer specifically asking for it.

For instance, if y and z are float, and a is int, when the statement z = a + y is executed, the value of a will be stored in a temporary memory location as float for use in the rest of the statement. Then, the addition is done (in float form) and finally, the result stored in z. During this statement, a was implicitly converted into float during the execution of the statement.

Another form of implicit conversion ...