Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

what are the advantage of pointer variables? write a program
to count the number of vowels and consonants in a given string

Answer Posted / gaurav kumar

#include <stdio.h>

int vowel;
int consonant;

void check_vowel(char c)
{
if ( c != 'a' && c != 'e' && c != 'i' && c != 'o' && c != 'u' && c != 'A' && c != 'E' && c != 'I' && c != 'O' && c != 'U')
consonant ++;
else
vowel++;
return;
}

int main(void) {
char p[25];
char *ptr=p;

printf("Enter a string:");
scanf(" %[^\n]25s",p);

printf("%s\n",p);
printf("%c\n",*p);

while(*ptr != '\0')
{
if(*ptr != ' ')
check_vowel(*ptr);
ptr++;
}
printf("The number of vowels : %d and consonants : %d in %s \n",vowel,consonant,p);

return 0;
}

Please mail me if any compact solution?

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are high level languages like C and FORTRAN also known as?

1155


What does 3 mean in texting?

1083


i got 75% in all semester am i eligible for your company

2208


Write a program to display all the prime nos from 1 to 1000000, your code should not take time more than a minute to display all the nos.

2053


What does *p++ do? What does it point to?

1038


a c code by using memory allocation for add ,multiply of sprase matrixes

2778


What are the uses of null pointers?

1085


what is the format specifier for printing a pointer value?

1005


What is difference between function overloading and operator overloading?

1074


What is selection sort in c?

1063


find out largest elemant of diagonalmatrix

2235


What do you mean by Recursion Function?

1106


how to execute a program using if else condition and the output should enter number and the number is odd only...

2268


Differentiate between declaring a variable and defining a variable?

1020


Why is c so powerful?

1101