mockers
Would you like to react to this message? Create an account in a few clicks or log in to continue.

typecasting-"ek chota sa doubt story!!!"

2 posters

Go down

typecasting-"ek chota sa doubt story!!!" Empty typecasting-"ek chota sa doubt story!!!"

Post  $corpion Fri Jan 30, 2009 8:40 pm

y do we put f after a floating no in c...
like
float no=2.3f;
printf("%f",no);

even if we don put f it works fine...and we get the same output in both the cases..
$corpion
$corpion

Posts : 25
Join date : 2009-01-30
Age : 37

Back to top Go down

typecasting-"ek chota sa doubt story!!!" Empty Re: typecasting-"ek chota sa doubt story!!!"

Post  ramthegreatcv Fri Jan 30, 2009 9:06 pm

as far as i know:
the float numbers are actually Double by default.so ,u specifically use F or f to point out its an float.
on the other hand they still work without F or f,due to implicit type conversion from double to float.
if u note, even int and char have such a relationship.
ramthegreatcv
ramthegreatcv

Posts : 55
Join date : 2009-01-30
Age : 36

Back to top Go down

typecasting-"ek chota sa doubt story!!!" Empty Re: typecasting-"ek chota sa doubt story!!!"

Post  ramthegreatcv Fri Jan 30, 2009 9:08 pm

http://en.wikibooks.org/wiki/C%2B%2B_Programming/Type_Casting

try this if u really want to learn about type-casting.like const and pointers,this needs a deeper insight.
all thanks to cutie Wink
ramthegreatcv
ramthegreatcv

Posts : 55
Join date : 2009-01-30
Age : 36

Back to top Go down

typecasting-"ek chota sa doubt story!!!" Empty @dubey

Post  mnnnit.r Fri Jan 30, 2009 10:24 pm

actually jo constant humne diya hai agar hum f nahi lagate hai to compiler use integer treat karta hai n jab hum use float varialbe mien assign karte hia to uski upcasting karta hai
on the other sie
if we write f after constant it represents the value is float and it doesn't need any upcasting

mnnnit.r
Guest


Back to top Go down

typecasting-"ek chota sa doubt story!!!" Empty Re: typecasting-"ek chota sa doubt story!!!"

Post  $corpion Sat Jan 31, 2009 10:35 pm

@Ramp
thanx man..u r right ..
but mr guest ..din get ur logic man..
i think u shd go thro wat ramp has said..his logic seems more perfect..
$corpion
$corpion

Posts : 25
Join date : 2009-01-30
Age : 37

Back to top Go down

typecasting-"ek chota sa doubt story!!!" Empty Re: typecasting-"ek chota sa doubt story!!!"

Post  Sponsored content


Sponsored content


Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum