View Single Post
Old 10-04-2007, 12:30 PM   #6 (permalink)
ergdork
Tilted
 
Variable initialization

Quote:
Originally Posted by zero2
It now works after Jinnkai's suggestion of each variable having it's own line. That's really weird because normally it works, maybe the compiler didn't like it this time, since I had so many variables on one line.

A lot of compilers will sometimes (in debug mode) initialize variables to reasonable values.. what you did at the top:

double var1, var2, var3 = 0;

is initializing ONLY var3. Sometimes you can get lucky and var1 and var2 will be 0. the correct line would be:

double var1=0, var2 = 0, var3 = 0;
__________________
"You're only given a little spark of madness. You mustn't lose it."
- Robin Williams
ergdork is offline  
 

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73