Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- int obrni(int broj)
- {
- int novi=0;
- while(broj!=0)
- {
- novi*=10;
- novi+=broj%10;
- broj/=10;
- }
- return novi;
- }
- char* funkcija(char string[])
- {
- char* p=string;
- char nova[80];
- char *s=nova;
- int br;
- while(*p!='\0')
- {
- if(*p>='0'&& *p<='9')
- {
- br=0;
- while(*p>='0'&& *p<='9')
- {
- br+=(*p-'0');
- p++;
- }
- br=obrni(br);
- while(br!=0)
- {
- *s++=(char)(br%10+'0');
- br/=10;
- }
- }
- else
- *s++=*p++;
- }
- *s='\0';
- strcpy(string, nova);
- return string;
- }
- int main()
- {
- char rijec[88]= {"Neki broj 124, 90, 55555"};
- char nova[88];
- char* p=nova;
- p=funkcija(rijec);
- while(*p!='\0')
- {
- printf("%c", *p++);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement