![]() |
Access violation of initializing string
I tried to create a code that would delete any same words or phrases in a string that was passed by pointer parameter. This is the outcome:
Code:
void DeleteString(char *chString, char *chDelString)char *x = "a word and another word"; DeleteString(x, "word"); This is meant to remove any phrase that are labeled "word" plus any spaces before it. So when x is displayed on the screen, it should output "a and another". But, when it gets to the point in the function showed in ---... it tries to assign the space to the character next to it which in this case would be 'w' but the program breaks at that point and shows that it is an access violation. Does anyone know the solution to this problem? |
Re: Access violation of initializing string
I am sorry about how the code was shown here is a better format:
Code:
void DeleteString(char *chString, char *chDelString) |
| All times are GMT +5.5. The time now is 21:14. |