Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- void mini_max(char *min,char *max,char *str)
- {
- int i=0;
- if(str[i]!='\0')
- {
- if(*min > str[i]) min = str[i];
- if(*max =< str[i]) max = str[i];
- i++;
- mini_max(&min,&max,char *(str+i);
- }
- }
- int main(void)
- {
- char str[10]="\0";
- unsigned int i;
- for(i=0;i<10;i++)
- str[i]='a' + rand() % ('z' - 'a');
- printf("%s \n", str); //wypisz zawartość łancucha str
- char min=str[0], max=str[9];
- mini_max(&min,&max,str);
- return 0;
- }
Add Comment
Please, Sign In to add comment