how to delete elements from char array?
for example if i had 6. elements in array and i need to deletе from 3. to 5. element?
how to delete elements from char array?
for example if i had 6. elements in array and i need to deletе from 3. to 5. element?
The elements from indices 3 to 5 are the last three elements of the array of 6 elements, so it would suffice to reduce the value of the variable keeping track of the number of elements in use to 3, i.e., so that only the elements from indices 0 to 2 will be used. Hence, the other elements would have effectively been deleted. Of course, if you have elements that come after the deletion range, then you should copy them over.
If this array stores a string, then you should also keep in mind that the string needs to be null terminated, though then you don't need a variable to keep track of the number of elements.
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)