By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,171 Members | 1,020 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,171 IT Pros & Developers. It's quick & easy.

variable type

P: n/a
Just out of curiosity, if a program uses a FLOAT type with a FOR loop
counter instead of an INT type, would this cause any slow-down in
performance or other problem (other than excess memory allocation for the
variable)?

eg.

float count; // instead of int count

for (count =1; count <=4, count++)

{

//code here

}
Jul 22 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
"Mike Hodkin" <mh*****@comcast.net> wrote in message
news:fc********************@comcast.com...
Just out of curiosity, if a program uses a FLOAT type with a FOR loop
counter instead of an INT type, would this cause any slow-down in
performance
Maybe, maybe not. Only way to know is to measure.
or other problem
If you're using other than integer values, yes, precision
could be a problem.
(other than excess memory allocation for the
variable)?
You can't assume that a 'float' is larger than an 'int'.

eg.

float count; // instead of int count

for (count =1; count <=4, count++)

{

//code here

}


Why do you want to use type 'float'?

-Mike
Jul 22 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.