Thanks for your reply
I thought it was pretty useless to use O,E,I pointers as well. I only swapped them in the loop body to try and make them work thinking the pointers may have been my issue.
are you saying I should use current_letter to point my array pointer
to the correct value ... example *stringletters[current_letter]
or just use it to guide the for loop?
I made the swaps based on your comments but it still isn't working properly... I'm pretty sure it has to do with *stringletters and *current_letter..
*Current_letter doesn't point to anything so I think I misunderstood what you mean...
Heres what I have now
Code:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(void){
char line[50];
char *stringletters = line;
char *current_letter;
int e_count;
int i_count;
int o_count;
printf("Enter characters:\n");
fgets(stringletters, 50, stdin);
for (current_letter = line; *current_letter != '\0'; ++current_letter)
{
if(*stringletters == 'e'){
e_count++;
}
if(*stringletters == 'i'){
i_count++;
}
if(*stringletters == 'o'){
o_count++;
}}
printf("Vowels E or e: %d \n" ,e_count);
printf("Vowels I or i: %d \n" ,i_count);
printf("Vowels O or o: %d \n" ,o_count);
system("pause");
return 0;
}