[CODE] for(i = 0; i < * ptrX; i++){ if((strcmp(fn, pb[i]->firstName) ==0) && (st
ID: 3656099 • Letter: #
Question
[CODE] 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); } } } [/CODE]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.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);Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.