Let's say I have an array with ten values inside of it, and i delete the one in the middle. How can i get the one after middle to go in the middle and get rid of the space in between the 2 half...
??
Thanx :D
Printable View
Let's say I have an array with ten values inside of it, and i delete the one in the middle. How can i get the one after middle to go in the middle and get rid of the space in between the 2 half...
??
Thanx :D
this is assuming your using a null-terminated (C-Style) string:
you can do the same thing with arrays if you know how many values are in it... you can modify this code to do what you want...Code:int index=5; //the char you will be deleting
int stringLength=strlen(yourCstring)-1; // <cstring>
for(index;index<stringLenghth;index++) //loop from where you deleted to the end
yourCstring[index]=yourCstring[index+1]; //replace it with the next value
yourCstring[index+1]='\0'; //terminate the string