I came cross a question: float f=-1; float f=0x1203; float f=012; To my suprised,all is compliation to succeed. why the primitive type of folat can declear are this way. Thank u very much. [ February 19, 2003: Message edited by: frank yang ]
Look at me and hear me<br />Because I am here<br />Just for that
Frank, This is the order or widening byte--> short--> int-->long-->float-->double and char-->int in your example, float is assigned integer values which is acceptable. An automatic widening of int values into float takes place but if you say int i = 2.3f , it needs an explicit cast because it is in the oppostie order in the above tree. so int i = 2.3f //compiler error int i = (int)2.3f // ok Sri