Hi
I haven't initialised a variable, and so the value I'm getting from it is some floating point number? I know this is because I haven't initialised it, but why does it contain a floating point number?
Thanks
Hi
I haven't initialised a variable, and so the value I'm getting from it is some floating point number? I know this is because I haven't initialised it, but why does it contain a floating point number?
Thanks
It contains whatever was in memory before your program was run...maybe code...maybe other variables....maybe Bill Gate's phone number.....no way to know unless you get dialling!
Because the variable type you declared is floating point, the bits in that memory location are just interpreted as a floating point number. Remember, all variables are is just bits, plain and simple.
[email protected]
Microsoft Visual Studio .NET 2003 Enterprise Architect
Windows XP Pro
Code Tags
Programming FAQ
Tutorials
it could actually be some of your post in this thread... the bits are just read as a float instead of chars...
Join is in our Unofficial Cprog IRC channel
Server: irc.phoenixradio.org
Channel: #Tech
Team Cprog Folding@Home: Team #43476
Download it Here
Detailed Stats Here
More Detailed Stats
52 Members so far, are YOU a member?
Current team score: 1223226 (ranked 374 of 45152)
The CBoard team is doing better than 99.16% of the other teams
Top 5 Members: Xterria(518175), pianorain(118517), Bennet(64957), JaWiB(55610), alphaoide(44374)
Last Updated on: Wed, 30 Aug, 2006 @ 2:30 PM EDT
Yes, it's impossible for a float or double to contain anything besides a float or double -- whatever those 32 or 64 bits contain, it will be interpreted as a floating point. Technically I suppose you could get NaN as well, but the odds of that are very small.
You ever try a pink golf ball, Wally? Why, the wind shear on a pink ball alone can take the head clean off a 90 pound midget at 300 yards.