Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I am trying to do a swap. I have to use the -> operator. The purpose of this is

ID: 3656100 • Letter: I

Question

I am trying to do a swap. I have to use the -> operator. The purpose of this is to delete a contact in a phonebook. The previously mentioned operator has to be used because it is the easiest way to get the data to all functions. for(i = 0; i < * ptrX; i++){ if((strcmp(fn, pb[i]->firstName) ==0) && (strcmp(ln, pb[i]->lastName) ==0)){ for(j = 0; j < * ptrX; j++){ strcpy(pb[j]->firstName, pb[j+1]->firstName); strcpy(pb[j]->clastName, pb[j+1]->lastName); strcpy(pb[j]->homeNumber, pb[j+1]->homeNumber); strcpy(pb[j]->cellNumber, pb[j+1]->cellNumber); } } }

Explanation / Answer

(i = 0; i < * ptrX; i++){ if((strcmp(fn, pb[i]->firstName) ==0) && (strcmp(ln, pb[i]->lastName) ==0)){ for(j = 0; j < * ptrX; j++){ strcpy(pb[j]->firstName, pb[j+1]->firstName);
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote