Hello, I have a couple of questions on what I may be doing wrong. I always come to this forum and get great answers whenever I'm stuck so I'm hoping the community can help me out yet again.

So, I am making a record structure and playing around a little with passing it through a function (calling by reference) and making an array of the structure to run through the function as well.

The first problem (or confusion if you will) I am running into is where the instructions say to:

Write a function int chk_overlap(RectT *r1, RectT *r2) which can be called to check if a and b overlap or not. If so return 1, else return 0.
Now, when I just have the function with the parameters there I am getting an error message of:

missing ) before *
My lines of code declaring the struct:

Code:
typedef struct Rect
        {
                double x;
                double y;
                char color;
                double w; ///width
                double h; //height
        } RectT;

        RectT a, b, *recs;
My function:

Code:
int chk_overlap(RectT *r1, RectT *r2){

                if(r1 == r2)
                        return 1;

                return 0;

        }


The second problem arrives when I am instructed to:

Dynamically create an array of 50 rectangles and save their address in recs. Then randomly initialize x, y, w, h of each rectangle (e.g., recs[i].x = rand()%20; etc...)
Using lines:

Code:
 int i;
        for(i = 0; i < 50; i++){
                recs[i].x = rand()%20;
                recs[i].y = rand()%20;
                recs[i].w = rand()%20;
                recs[i].h = rand()%20;
        }
lets me compile but gives a seg fault when trying to store/print each item, so I'm guessing using recs[?] cannot be done after using *recs.



I have been able to store in a.x, a.y... etc., but I'm having trouble when 1) passing struct through the function and 2) creating the array of structures. In no means am I posting hoping to receive the answer, as I feel a lot of people think judging the responses I sometimes will get, but getting any guidance on a little mishap here or there, someone else catching a mistake I made in my code, or if I am missing the concept of what I am doing and being told what I don't understand can really help get me over the hump. I am a student going through college and trying to learn, bashing really does nothing for anyone.