The
assignment statement
in C
- The assignment statement
in C has the
same syntax and
meaning as
Java:
var = expression ;
(1) Evaluate the expression on the RHS
(2) Convert if necessary to the correct data type
(3) Assign the result to the variable on the LHS
|
- Warning:
- C will
always perform
the
conversion
automatically for
number data types
-
Even
when the RHS value is
a
wider
data type than the
LHS variable !
|
|
An assignment
statement example
to hightlight the difference in C and Java
DEMO:
demo/C/set1/casting3.c
An assignment
statement example
to hightlight the difference in C and Java
DEMO:
demo/C/set1/casting3.java
❮
❯