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
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
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
Last edited by major_small; 03-13-2004 at 09:43 PM.
Join is in our Unofficial Cprog IRC channel
Server: irc.phoenixradio.org
Channel: #Tech
Team Cprog Folding@Home: Team #43476
Download it Here
Detailed Stats Here
More Detailed Stats
52 Members so far, are YOU a member?
Current team score: 1223226 (ranked 374 of 45152)
The CBoard team is doing better than 99.16% of the other teams
Top 5 Members: Xterria(518175), pianorain(118517), Bennet(64957), JaWiB(55610), alphaoide(44374)
Last Updated on: Wed, 30 Aug, 2006 @ 2:30 PM EDT