I have a function in C that should receive a string, and pointers that have the number of numbers and vowels that are present in the string, but the function is not adding up each time it finds a number or a vowel. Here is my code:
int main(){
char string[12]={"5bana22anab5"};
bool palindromo = true;
int qtdnumero=0,qtdvogal=0,qtdoutros=0;
informacoes(string,&palindromo,&qtdnumero,&qtdvogal,&qtdoutros);
if(palindromo == true){
printf("true ");
}else printf("false ");
printf("numeros: %d vogais: %d outros: %d",qtdnumero,qtdvogal,qtdoutros);
}
void informacoes(char str[12], bool *palindromo, int *qtdnumero, int *qtdvogal, int *qtdoutros){
int i, j=11,igual=1;
for(i=0;i<6;i++){
if(str[i]!=str[j]){
igual=0;
}
if(str[i]=='0' || str[i]=='1' || str[i]=='2' || str[i]=='3' || str[i]=='4' || str[i]=='5' || str[i]=='6' || str[i]=='7' || str[i]=='8' || str[i]=='9')
*qtdnumero++;
else if(str[i]=='a' || str[i]=='e' || str[i]=='i' || str[i]=='o' || str[i]=='u'){
*qtdvogal++;
}
else
*qtdoutros++;
if(str[j]=='0' || str[j]=='1' || str[j]=='2' || str[j]=='3' || str[j]=='4' || str[j]=='5' || str[j]=='6' || str[j]=='7' || str[j]=='8' || str[j]=='9')
*qtdnumero++;
else if(str[j]=='a' || str[j]=='e' || str[j]=='i' || str[j]=='o' || str[j]=='u'){
*qtdvogal++;
}
else
*qtdoutros++;
j--;
}
if (igual==0){
*palindromo=false;
}
}
The result of the function is = true numbers: 0 vowels: 0 others: 0 Does anyone have any idea why the function is not incrementing the counters?