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