Hello all! I have been out of programming for years, but have a lot of (old) experience programming in C, C++ and Java. I just got back into it and am realizing quickly that Objective C is a bit of a different animal. Anyway to the question at hand.
In one of my methods I have the following lines of code:
Updating this array directly:
works like a champ.
What I want to do though is pass these arrays of structs as parameters to a function that will then update them with new values.
I can't seem to get pass by reference to work.
With the following function dec:
and the function call from the main code as follows:
I get a warning that I am passing an incompatible pointer type.
I have tried just about everything I can think of to get this to work. I know it is something simple, but I have been looking at this too long.
Thanks in advance for the help!!!!
In one of my methods I have the following lines of code:
Code:
cpVect verts1[] = { cpv(0.0, 0.0), cpv(50.0, 0.0), cpv(45.0, -15.0), cpv(0.0, -15.0) };
cpVect verts2[] = { cpv(0.0, 0.0), cpv(50.0, 0.0), cpv(45.0, -15.0), cpv(0.0, -15.0) };
cpVect slab[] = { cpv(0.0, 0.0), cpv(50.0, 0.0), cpv(45.0, -15.0), cpv(0.0, -15.0) };
//cpVect and CGPoint are the same thing by the way.
Code:
verts1[0].x = 5.0;
verts1[0].y = 5.0;
What I want to do though is pass these arrays of structs as parameters to a function that will then update them with new values.
I can't seem to get pass by reference to work.
With the following function dec:
Code:
-(BOOL) buildHouse: (cpVect **)verts1 : (cpVect **)verts2 : (cpVect **) hori
{
verts1[0]->x = 5.0
return(FALSE);
}
Code:
while ([self buildHouse:&vertsWall1 :&vertsWall2 :&slab])
{
}
I have tried just about everything I can think of to get this to work. I know it is something simple, but I have been looking at this too long.
Thanks in advance for the help!!!!
Last edited by a moderator: