View Full Version : init problem
02-14-2002, 11:35 PM
i have a problem with initialization i have a array of points i'm doing initialization on the x axis like this
the results are:
for j=0 point[i].x=-1 correct
for j=1 point[i].x=-1 not correct !!!
for j=2 point[i].x=-0.333333 again not correct except for point.x which is correct (0.33333) where is the problem ?
Use 2.0/3.0 instead of 2/3. Without '.0', you get integer division.
02-15-2002, 11:04 PM
Done that but still it isn't working
02-17-2002, 04:16 AM
ok i have done some debugging and it seems that the problem is only with the last row (i mean point[i]) which is -1.0f when it should be 0.03333f
when i added printf at * point everything was OK but at ~ point it has shown incorrect values(-1 it should be 0.33333) except for that point which is ok can someone help me with that
When I run the following code, it gives the correct results. You should check your code for typing mistakes. For example, I have a tendency to swap i's and j's.
double x, y;
int i, j;
printf("point[%d][%d].x=%f\n", i, j,
02-18-2002, 01:55 AM
Powered by vBulletin® Version 4.2.0 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.