I have a function that takes an x an y coordinate as parameters

void storecoords(float x, floaty)

{

float Array[][2];

}

I need to store a number of x,y coordinates in an array such that:

Array [x1 ][x2][x3][x4][x5] ...

[y1 ][y2][y3][y4][y5] ...

i.e.

As the x y coordinates are recieved by the function I need to

1) check if the coordinates are in the array.

2) if if the coordinates are do nothing.

3) if the coordinates are not in the array: add the coordinates to the array.

n.b the array must be able to grow dynamically as more and more coordinates are added?

Any suggestions appreciated?

Thanks,

If the array must be able to grow, you cannot define it as static data, or heap data with 'float Array[][2]'. You'll have to use malloc(), calloc(), and/or realloc() to grow the array.

It really is a piece of cake to put into effect. In fact, if you can live with a singly dimensioned array this is almost trivial, and it will certainly be "standard C". A singly dimensioned array would put the X,Y pairs into consecutive locations. For any pair (N) that is in the array, X is at location (X * 2) and Y is at (X * 2 + 1).

Kent