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 is a struct c#?
What are the keywords in c?
What is the condition that is applied with ?: Operator?
How do you declare a variable that will hold string values?
Is register a keyword in c?
Explain what is the difference between null and nul?
Explain what is wrong with this program statement?
The postoder traversal is 7,14,3,55,22,5,17 Then ur Inorder traversal is??? please help me on this
What is meant by int main ()?
What is the purpose of the preprocessor directive error?
What is the basic structure of c?
Can you write the algorithm for Queue?
What are compound statements?
a formula,a series of steps,or well defined set of rules for solving a problem a) algorithem b) program c) erdiagram d) compiler
What is the use of function overloading in C?