Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


what are the advantage of pointer variables? write a program
to count the number of vowels and consonants in a given string

Answers were Sorted based on User's Feedback



what are the advantage of pointer variables? write a program to count the number of vowels and cons..

Answer / rama krishna sidhartha

The advantage of pointer variables is to reduce the memory
space of another variables.

I don't know how to write the program for counting the
vowels and consonants. If anybody knows please mail to

sidhartha_karyampudi@rediffmail.com

Is This Answer Correct ?    3 Yes 0 No

what are the advantage of pointer variables? write a program to count the number of vowels and cons..

Answer / 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

what are the advantage of pointer variables? write a program to count the number of vowels and cons..

Answer / vadivelt

#include<stdio.h>
#include<conio.h>

CountVowCons(char *ptr, int *count);

int main()
{
char *ptr;
int count[2];
ptr = (char *)malloc(200);
printf("ENTER INPUT STRING\n");
ptr = gets(ptr);
CountVowCons(ptr, count);
printf("\nNO OF VOWELS:%d \nNO OF CONS: %d",count[0], count
[1]);
getch();
}

CountVowCons(char *ptr, int *count)
{
int Vowcount = 0, Conscount = 0;
while(*ptr != '\0')
{
if((*ptr == 'a') || (*ptr == 'A') || (*ptr == 'e') ||
(*ptr == 'E') || (*ptr == 'i') ||
(*ptr == 'I') || (*ptr == 'o') || (*ptr == 'O') ||
(*ptr == 'u') || (*ptr == 'U'))
{
Vowcount++;
}

else if((*ptr >= 65 && *ptr <= 90) ||
(*ptr >= 97 && *ptr <= 122))
{
Conscount++;
}

ptr++;
}

*count++ = Vowcount;
*count = Conscount;
count--;
}

Is This Answer Correct ?    1 Yes 2 No

Post New Answer

More C Interview Questions

What’s the special use of UNIONS?

0 Answers   ADP,


Explain what is a stream?

0 Answers  


what is the basis for selection of arrays or pointers as data structure in a program

0 Answers   TCS,


will the program compile? int i; scanf(ā€œ%dā€,i); printf(ā€œ%dā€,i);

3 Answers  


Write a program to find the biggest number of three numbers in c?

0 Answers  


Write a c program to print the even numbers followed by odd numbers in an array without using additional array

1 Answers   Tech Mahindra,


Function which gives a pointer to a binary trees const an integer value at each code, return function of all the nodes in binary tree.?

0 Answers   Infosys,


Explain about the functions strcat() and strcmp()?

0 Answers  


Difference between pass by reference and pass by value?

0 Answers   TCS, TISL,


How can I find the modification date of a file?

0 Answers   Celstream,


Write a program to reverse a given number in c?

0 Answers  


What are keywords c?

0 Answers  


Categories