I have a simple function which removes brackets from a given phone number.<br>Eg: If the phoned number passed is (000) 123 4567 then the phone number returned is 000 123 4567.<br><br>The function goes as follows:<br>int RemoveBrackets(char *PhoneNumber)<br>{<br> int Result = 0;<br> char *OpenBracket = NULL,<br> *CloseBracket = NULL,<br> *BeginPhNum = NULL,<br> *EndPhNum = NULL;<br><br> /* Look for the opening bracket. */<br> OpenBracket = (char *)strstr(PhoneNumber, "("<br> if(OpenBracket != NULL)<br> {<br> BeginPhNum = ++OpenBracket;<br> <br> /* Look for the closing bracket.*/<br> CloseBracket = (char *)strstr(PhoneNumber, ""<br> if(CloseBracket != NULL)<br> {<br> EndPhNum = ++CloseBracket; <br> CloseBracket = --CloseBracket; <br> *CloseBracket = '\0'; <br> <br> printf("EndPhNum: %s\n", EndPhNum);<br><br> strcat(BeginPhNum, EndPhNum);<br><br> strcpy(PhoneNumber, BeginPhNum);<br><br> printf("PhoneNumber(out): %s\n", PhoneNumber);<br> <br> }<br> }<br><br>return(Result);<br>}<br><br><br>It works correctly, returning the phone number without the brackets but I don't actually understand how the contents of 'EndPhNum' are not null/blank after 'CloseBracket' has been nulled...? I khow it's something to do with the line CloseBracket = --CloseBracket; as when this is taken out EndPhNum is then blanked after *CloseBracket = '\0';<br>However when CloseBracket = --CloseBracket; is left in then somehow the contents of EndPhNum are preserved....<br><br>Much appreciated if anyone could shed some light on this ...