Here I have a structure definition:

```
typedef struct person {
unsigned int ssn, age, height, weight, income;
char name[MAXS+1], job[MAXS+1], religion[MAXS+1], major[MAXS+1], minor[MAXS+1], gender;
}PERSON;

```

And here I have an in-function array of structures of type PERSON definition:

```
    PERSON record[MAXR+1];

```

How would I pass this array to another function for live updating (i.e. as a pointer)?

My intuition and prior knowledge tells me to do the following:

```
PERSON *rp[MAXR+1];
for(i=0; i<MAXR; i++){
        *rp[i]=&record[i];
    }
valid=readfile(fp, rp);

```

However, I get an "incompatible types in assignment" error.
What's the proper way of doing this?

Here is the full code:

```
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>
#define MAXS 19
#define MAXR 999

typedef struct person {
unsigned int ssn, age, height, weight, income;
char name[MAXS+1], job[MAXS+1], religion[MAXS+1], major[MAXS+1], minor[MAXS+1], gender;
}PERSON;

//get and check ssn
int getssn(){
int num;

printf("\nSSN: ");
scanf("%d", &num);

if(num<=99999999 || num>999999999){
    printf("\nPlease input a valid SSN.\n");
    return 0;
}
else
    return num;
}

int readfile(FILE *fptr, PERSON **rptr){
int v=0, i, j;

for(i=0; i<MAXR; i++){
    j=i;
    if(fscanf(fptr, "%c\n%d\n%19s\n%d\n%19s\n%d\n%19s\n%19s\n%d\n%d\n%19s\n\n",
          &rptr[j]->gender, &rptr[j]->ssn, rptr[j]->name, &rptr[j]->age, 
          rptr[j]->job, &rptr[j]->income, rptr[j]->major, rptr[j]->minor,
          &rptr[j]->height, &rptr[j]->weight, rptr[j]->religion)==EOF)
        i=MAXR;
    if(&rptr[MAXR]->ssn==&rptr[j]->ssn)
        v=j;
}

return v;
}

int main(){
int valid=0, i;
char filename[MAXS]="clients.txt";
FILE *fp;
PERSON record[MAXR+1], *rp[MAXR+1];

do{
    record[MAXR].ssn=getssn();
}while(record[MAXR].ssn==0);

printf("Name of file of records: ");
//gets(filename);

if((fp=fopen(filename, "r"))==NULL)
    printf("\nCould not open file\n");
else{
    printf("\njur doing gohd\n");
    for(i=0; i<MAXR; i++){
        *rp[i]=&record[i];
    }
    valid=readfile(fp, rp);
    if(valid==0){
        printf("\nSSN %d is not found in file %s.\n", record[MAXR].ssn, filename);
    }
    else {
        printf("%d", valid);
    }
}

return 0;
}

```