Skip to main content
GameDev.net gamedev.net
🔒 Locked

Pointer Problem

Started by JeJu Feb 26, 2001 at 10:22 AM 3 replies 800+ views
Original Post
JeJu
JeJu
Hello I have a very basic problem with pointers. Look at this static void super(point3f *face, WFace *fac) { float buffer; int i=0; for(;i<=3; i++) { buffer = fac.v[0]; face[i].x = buffer; } } VC++ compiles it, but if I execute it, it says that there is an unhandled exception in the line face[i].x = buffer. What''s wrong with it. Please help me. Cheers Jens Jung
Mezz
Mezz
your comparision is <= 3 it should just be < 3

Arrays go from zero up, so a three element array has elements, 0, 1, 2.

Not a pointer problem, a loop problem!

-Mezz
JeJu
JeJu
Oh thanks. I prepare a bullet for me
JeJu
JeJu
Hmmh. It seems that this wasn''t the problem. I tried it but there was no change Aaaaaargh
JeJu
JeJu
Aaah I have it.
That''s the right code.
static void super(point3f *face, WFace *fac)
{
float buffer;
int i=0;
for(;i<=2;i++)
{
buffer = fac.v[0];
face = new point3f;
face[i].x = buffer;
}
}

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.