Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- void f(char *s1, char *s2) {
- char *p1=s1, *p2=s2, *pocetak, *kraj, *pi, *ci;
- while (*s1!='\0') {
- s2=p2;
- while (*s2!='\0') {
- if (*s1==*s2) {
- pocetak=s1;
- while (*s1==*s2 && *s2!='\0' && *s2!=' ') {
- s1++; s2++;
- }
- if (*s2=='\0' || *s2==' ') {
- kraj=s1;
- pi=pocetak;
- if (*s2==' ') ci=kraj+1;
- else ci=kraj;
- while (*ci!='\0') {
- *pi=*ci;
- pi++; ci++;
- }
- *pi='\0';
- }
- } s2++;
- } s1++;
- }
- s1=p1;
- while (*s1!='\0') {
- printf("%c", *s1);
- s1++;
- }
- printf("\n");
- }
- int main () {
- char s1[]="Jok zamijeni", s2[]="zamijeni nemoj", s3[]="zamijeni nemoj", s4[]="zamijeni jok";
- f(s1, s2);
- f(s3, s4);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement