I inserted the following code into my program before I remembered what variable type I was using and it works:
When I run this function and print my variables to screen, the "drop" has been removed and all the "name" variables have been moved down. Does anybody know why this works even though I know I'm supposed to have to use strcpy?Code:void somefunction () { char name[6][20]; char drop[20]; int total = 6; cin >>drop //variable user wants to remove from stack for (int j = 0; j < total; j++) if (strcmp (drop , name[j]) == 0) { for (int k = j; k < total; k++) team[k] = name[k + 1]; } }![]()



LinkBack URL
About LinkBacks



