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
Explain how do you print an address?
What is your stream meaning?
PLS U SENS ME INTERVIEW O. MY EMAIL ADD, SOFIYA.SINGH@GMAIL.COM
What is #line?
largest Of three Number using without if condition?
any restrictions have on the number of 'return' statements that may be present in a function. a) no restriction b) only 2 return statements c) only 1 return statements d) none of the above
Where define directive used?
Why can't I perform arithmetic on a void* pointer?
What are the c keywords?
What is merge sort in c?
What is a void * in c?
please help me..... please codes and flowchart plz turbo c lang po yan.....please asap response... 3. Make an astrology program. The user types in his or her birthday (month, day, and year as integer), and the program responds with the user’s zodiac sign, horoscope, and other information related to it. If the user’s birth year falls into a leap year, your program should display an appropriate message for it. NOTES: Conditional Statements: it should be with graphics
How to delete a node from linked list w/o using collectons?
What is c mainly used for?
Is null a keyword in c?