Contact: aviboots(AT)netvision.net.il
40,891 questions
53,304 answers
573 users
#include <stdio.h> #include <string.h> int main(void) { char s[64] = "pro c programming"; char dest[64] = ""; int N = 3; strcpy(s, (strcat(strcpy(dest, "XYZ"), s + N))); puts(s); return 0; } /* run: XYZ c programming */
#include <stdio.h> #include <string.h> int main(void) { char s[64] = "pro c programming"; char replace[4] = "XYZ"; int N = 3; for (int i = 0; i < N; i++) s[i] = replace[i]; puts(s); return 0; } /* run: XYZ c programming */