Wednesday, January 4, 2012

How do we declare more than one variable?

Variables of the same type may be declared in the same statement. However, each must be separated from the others by a comma; for example, the statement

float expense, income;

declares the variables expense and income to be of the float (which must be typed in lower case) type. Float type data contain a decimal point with or without a fraction. For example, 1..1.0, and 0.6 are float type data. When data without a decimal point are assigned to a float type variable, the C compiler automatically places a decimal point after the last digit.

No comments:

Post a Comment