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 high-order and low-order bytes.
Is c language still used?
What functions are used in dynamic memory allocation in c?
What is new line escape sequence?
How many levels deep can include files be nested?
Explain what is the difference between functions abs() and fabs()?
How can I get back to the interactive keyboard if stdin is redirected?
In which header file is the null macro defined?
What are the types of assignment statements?
What is meant by type specifiers?
What is file in c preprocessor?
How will you find a duplicate number in a array without negating the nos ?
any function have arguments one or more OR not . it is compulsary a) any function compulsary have one or more arguments b) any function did not have arguments. It is not compulsary c) it is optional it is not compulsary d) none of the above
Explain how do you override a defined macro?
WRITE A CODE IN C TO SEARCH A FILE FROM NOTEPAD FILE.