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
Which node is more powerful and can handle local information processing or graphics processing?
how can I convert a string to a number?
what is the basis for selection of arrays or pointers as data structure in a program
What are inbuilt functions in c?
in programming languages a statement or part of a statement that specifies several different execution sequences a) constructs b) distructs c) executes d) none
What is pre-emptive data structure and explain it with example?
write a program that types this pattern: 12345678987654321 12345678 87654321 1234567 7654321 123456 654321 12345 54321 1234 4321 123 321 12 21 1 1
What do you mean by c?
Is there anything like an ifdef for typedefs?
Do you have any idea how to compare array with pointer in c?
What is printf () in c?
What is the maximum no. of arguments that can be given in a command line in C.?
In C programming, what command or code can be used to determine if a number of odd or even?
How do you search data in a data file using random access method?
What is typedef struct in c?