Question: Implement the ordered version of removeElement in the window below. Your function should validate inputs and remove the element in the given position by moving
Implement the ordered version of removeElement in the window below. Your function should validate inputs and remove the element in the given position by moving all of the other elements down.
//why isn't this code working and what can i fix?
#include
bool removeElement(char array[], int numElems, int position){ if(position <=0 || position > numElems){ cout << "Invalid position "; return false; } else{ for (int i=position-1; i int main() { char array[5]={'a','b','c','d','e'}; bool result=removeElement(array,5,3); if (result == true){ cout << "Element is removed "; } else{ cout << "Element is not found"; } return 0; }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
