Advertisement
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[], int k)
- {
- char* p=string;
- char nova[80];
- char *s=nova;
- int minus=0;
- int i=0,br,cifra,brojac;
- while(*p!='\0')
- {
- if (*p=='-') minus=1;
- if(*p>='0'&& *p<='9')
- {
- br=0;
- brojac=0;
- while(*p>='0'&& *p<='9')
- {
- br*=10;
- br+=(*p-'0');
- p++;
- brojac++;
- }
- if(minus==1) br*=-1;
- if(br<=k)
- {
- p-=brojac;
- for(i=0; i<brojac; i++)
- {
- *s++=*p++;
- }
- }
- *s++=*p++;
- minus=0;
- }
- *s++=*p++;
- }
- *s='\0';
- strcpy(string, nova);
- return string;
- }
- int main()
- {
- char rijec[88]= {"Neki broj -5555, 5233, 5555"};
- char nova[88];
- char* p=nova;
- p=funkcija(rijec,5554);
- while(*p!='\0')
- {
- printf("%c", *p++);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement