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
What are high level languages like C and FORTRAN also known as?
What does 3 mean in texting?
i got 75% in all semester am i eligible for your company
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.
What does *p++ do? What does it point to?
a c code by using memory allocation for add ,multiply of sprase matrixes
What are the uses of null pointers?
what is the format specifier for printing a pointer value?
What is difference between function overloading and operator overloading?
What is selection sort in c?
find out largest elemant of diagonalmatrix
What do you mean by Recursion Function?
how to execute a program using if else condition and the output should enter number and the number is odd only...
Differentiate between declaring a variable and defining a variable?
Why is c so powerful?