Note that there are some explanatory texts on larger screens.

plurals
  1. POint value jumps from 0 to 32679 without change
    primarykey
    data
    text
    <p>I have a really, really weird problem that I just can't figure out. So you can have a look, here is my code;</p> <pre><code>point * findLongPaths(point * points, double threshold_distance) { int i = 0; int pointsAboveThreshold = countPointsAboveThreshold(points, threshold_distance); point * pointsByThreshold = new point[sizeof(points)]; pointValues * pointsToCalculate = new pointValues[pointsAboveThreshold]; //pointValues pointsToCalculate[pointsAboveThreshold]; //point orderedPoints[pointsAboveThreshold]; while (points[i].end != true) { point pointOne = points[i]; point pointTwo = points[i + 1]; //Check to see if the distance is greater than the threshold, if it is store in an array of pointValues double distance = distanceBetweenTwoPoints(pointOne, pointTwo); if (distance &gt; threshold_distance) { pointsToCalculate[i].originalLocation = i; pointsToCalculate[i].distance = distance; pointsToCalculate[i].final = pointTwo; //If the final point has been calculated, break the loop if (pointTwo.end == true) { pointsToCalculate[i].end = true; break; } else { pointsToCalculate[i].end = false; i++; } } else if (points[0].end == true || pointsAboveThreshold == 0) { //If there is no points above the threshold, return an empty point if (points[0].end == true) { point emptyPoint; emptyPoint.x = 0.0; emptyPoint.y = 0.0; emptyPoint.end = true; pointsByThreshold[0] = emptyPoint; return pointsByThreshold; } } i++; } i = 0; //Find the point with the lowest distance int locationToStore = 0; while (pointsToCalculate[i].end != true) { </code></pre> <p>My problem is, the i value literally goes from 0 to 32679. I originally had it set to j, so it was using a different counter to the one in the while loop before but I tried it with the <code>i</code> to see if it would make a difference.</p> <p>I have tried it in both VC++ and XCode and both are doing it. However, if I place a breakpoint a few lines before it, it stays as a zero. If I run it without any breakpoints, it changes the value to 32679. </p> <p>Why is this? It's really weird and I have no idea how to fix it?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload