I have a varible containing a 7-digit phone number e.g. 5551212 that can hold up to 10 chars. My system has a default area code of 3 digits e.g. 631. I need to prefix the phone number with the areacode, giving me a resultant string of 6315551212.
Is the following legal
sprintf(phonenum, %3.3s%7.7s, default_area_code, phonenum);
in other words having phonenum as both the source and target.
Or, doI need to use an intermediate variable e.g.
sprintf(temp_phonenum, %3.3s%7.7s, default_area_code, phonenum);