• Post Reply Bookmark Topic Watch Topic
  • New Topic

when i use float gg =10f;// flaot gg = 10;

 
giribabu rosi
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
tell me?
 
Tom Johnson
Ranch Hand
Posts: 142
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Default for floating point numbers is double so to put data into a float u have to explicitly tell compiler this.
However its not needed it the value you're putting in is same size or smaller than float.



myFloat1 explicitly indicated as a float, without it there is a compile error as double 190.245, the default without the f suffix, wont fit into float

//tom
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!