Код:
#include<stdio.h>
#include<string.h>
bool is_vowel( char letter )
{
char *v_arr="aeiouy";
int i;
for( i=0; i<strlen(v_arr); i++ )
{
if( v_arr[i] == letter )
return true;
}
return false;
}
void parse( char *src , int len , char new_sym )
{
int i;
for( i=0; i<len; i++ )
{
if( is_vowel(src[i]) )
src[i] = new_sym;
}
printf("Result str : %s\n" , src );
}
int main( int argc , char*argv[] )
{
char str[] = "this is a test string , and some words";
printf("Before : %s\n" , str );
parse( str , strlen(str) , '&' );
return 0;
}
Код:
Before : this is a test string , and some words
Result str : th&s &s & t&st str&ng , &nd s&m& w&rds