curagea 0 Newbie Poster

I have in my code two separate arrays to store values, uCurve and vCurve. Both are arrays of pointers to math vectors:

Curve uCurve, vCurve;
	uCurve[0] = &(bezcurveinterp(cP[0][0], cP[0][1], cP[0][2], cP[0][3], v).p);
	uCurve[1] = &(bezcurveinterp(cP[1][0], cP[1][1], cP[1][2], cP[1][3], v).p);
	uCurve[2] = &(bezcurveinterp(cP[2][0], cP[2][1], cP[2][2], cP[2][3], v).p);
	uCurve[3] = &(bezcurveinterp(cP[3][0], cP[3][1], cP[3][2], cP[3][3], v).p);
	
	printf("\nPoints in ucurve:\n");
	printoutcurve(uCurve);
	
	vCurve[0] = &(bezcurveinterp(cP[0][0], cP[1][0], cP[2][0], cP[3][0], u).p);
	vCurve[1] = &(bezcurveinterp(cP[0][1], cP[1][1], cP[2][1], cP[3][1], u).p);
	vCurve[2] = &(bezcurveinterp(cP[0][2], cP[1][2], cP[2][2], cP[3][2], u).p);
	vCurve[3] = &(bezcurveinterp(cP[0][3], cP[1][3], cP[2][3], cP[3][3], u).p);
	
	printf("\nPoints in vcurve:\n");
	printoutcurve(vCurve);
	printf("\nPoints in ucurve now:\n");
	printoutcurve(uCurve);

The problem I'm having is that, after vCurve have its values stored, uCurve ended up getting the same contents as vCurve. In essence, uCurve now == vCurve.

I'm out of my mind trying to figure out why this is happening. Nowhere during the assignments for vCurve did I modify uCurve; the two are supposed to have different values stored in them.

What's stranger is that my friend has the exact code running on his Linux machine (I have Windows), and he doesn't have this problem.

Anyone might have a clue on what's going on?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.