Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


compiler error help

im trying to write a program that counts the total vowels in a string and count the number of each individual vowel(like total A's=4 and so on) Im stuck with my fisrt function to count the total vowels im getting a compiler error that says expected primary expression before '}' token.I cant figure out what that means can someone help

             #include <stdio.h>

        int countvowels(char []);
       //int displayleachvowels(char[]);

     int main ()
        char sentence[150];
        int vowels=0;

           printf("Enter a sentence \n");


           vowels = countvowels(sentence);

           printf("Number of vowels: %d\n", sentence);

          // total=displayleachvowels(sentence);

          // printf("Total A's:,E's,I'sO's,U's, %d\n%d\n%d\n%d\n%d\n", sentence);

     return 0;
   int countvowels(char sentence[])
   int x;
   int count=0;


      if(sentence[x]=='a' || sentence[x]=='e' || sentence[x]=='i' ||
       sentence[x]=='o' || sentence[x]=='u' || sentence[x]=='A' ||
       sentence[x]=='E' || sentence[x]=='I' || sentence[x]=='O' ||

     }//error pointing here




  • B00B00 Member Posts: 115 ✭✭✭

    Your if statement on lines 35-38 is unfinished. Add at least {} a the end of it for compiler to be happy.

Sign In or Register to comment.