0
Question about C
Why do we do : Average =(float) a+b; Why not this : Float average = a+b ???
5 ответов
+ 2
Average is a new variable and a is another variable.if you declare Average as float datatype a also have to be of float datatype so we do conversion .
+ 1
Ohhhh so you mean , a and b needs to be float not string or char ?
0
All three variables must be in the some datatype .Here you do an addition so you can not do addition with different variables datatype so you can not added a float to string or float to integer You will store the addition result as float not as string or integer this will produce a type error