Answers for "hwo to copy an array structs to another in c"

1

hwo to copy an array structs to another in c

typedef struct Person{
int phone;
char first[150];
char last[150];
char mail[150];
} person;

void person_copy(person arr1[], person arr2[], int size){
  int i;

  for(i=0; i<size; i++){
    arr2->phone = arr1->phone;
    strcpy(arr2[i].first, arr1[i].first);
    strcpy(arr2[i].last, arr1[i].last);
    strcpy(arr2[i].mail, arr1[i].mail);
  }
}
Posted by: Guest on April-04-2021

Code answers related to "hwo to copy an array structs to another in c"

Code answers related to "TypeScript"

Browse Popular Code Answers by Language