/* Write a function int count_change (char old_str[], new_str[]) that has two parameters, strings of characters. The function replaces all '$' characters with letter 'a'. Function counts and returns the number of replacements made. Write main that reads 5 strings (use loop), for each string the function prints the string AFTER the function is called and the number of replacements made. */ #include #define SIZE_STR 20 int count_change(char old_str[], char new_str[]); int main(){ char old_str[SIZE_STR], new_str[SIZE_STR]; printf("enter string \n"); scanf("%s",old_str); printf("number of changes is %d\n",count_change(old_str,new_str)); printf("old string %s\n",old_str); printf("new string %s\n", new_str); return 0; } int count_change(char old_str[], char new_str[]){ int i=0, count=0; while(old_str[i]!='\0'){ if(old_str[i]=='$'){ new_str[i]='a'; count++; } else{ new_str[i]=old_str[i]; } i++; } new_str[i]='\0'; return count; }