Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <string.h>
- int main(void) {
- char text[40] = "00123000123000";
- text[39] = '\0';
- int i;
- char *pos = text[0];
- for (i = 0; i < 10; i++) printf("%c", text[i]);
- printf("\n");
- // Нужно чтобы поиск был с последнего вхождения!
- while (pos = strstr(&pos, "123")){
- //pos = strstr(text, "1");
- *pos = '0';
- *(pos+1) = '0';
- *(pos+2) = '0';
- }
- for (i = 0; i < 10; i++) printf("%c", text[i]);
- /*pos =
- *pos = '0';
- printf("%c", text[2]);*/
- }
Advertisement
Add Comment
Please, Sign In to add comment