Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // разработать рекурсивную функцию удаления первого слова из строки
- #include <stdio.h>
- #include <stdlib.h>
- void delete(char *str){
- static int index;
- static int amount;
- if(str[0] == ' ' || str[0] == '\0'){
- str = realloc(str, amount * sizeof(char));
- return;
- }
- if(str[index] == '\0'){
- index = 0;
- amount++;
- }
- str[index] = str[index + 1];
- index++;
- delete(str);
- }
- int main(){
- char* str = (char*) calloc (100, sizeof(char));
- gets(str);
- puts(str);
- delete(str);
- puts(str);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement