answersLogoWhite

0


Best Answer

#include <stdio.h>

#include <stdlib.h>

#include <string.h>

main (int argc,char **argv)

{

char *a,*b,c;

int t,e;

if (argc<2) return(0);

a=argv[1];

b=a;

e=strlen(b);

for (t=0;t<=e;t++)

{

c = *b;

if (c>='A'&&c<='Z') c -= 'A'-'a';

if (c=='a'c=='e'c=='i'c=='o'c=='u') b++;

else *a++ = *b++;

}

printf ("%s\n",argv[1]);

return(0);

}

User Avatar

Wiki User

15y ago
This answer is:
User Avatar
More answers
User Avatar

Wiki User

14y ago

// Replace all vowels in str with 'z'

void replaceWithZ(char* str) {

int i = 0;

while(str[i] != 'z') {

if(isVowel(str[i])) {

str[i] = 'z';

}

++i;

}

}

// Returns 1 if ch is a vowel, 0 otherwise

int isVowel(const char ch) {

switch(ch) {

case 'a':case 'A':

case 'e':case 'E':

case 'i':case 'I':

case 'o':case 'O':

case 'u':case 'U':

return 1;

}

return 0;

}

// Sample call

int main() {

char str[] = "HELLO";

printf("%s\n", str);

replaceWithZ(str);

printf("%s\n", str);

return 0;

}

This answer is:
User Avatar

User Avatar

Wiki User

13y ago

Basically you could have a method like this:

//returns the indexes of the vowels in char array s, optionally including Y's

int[] FindVowels(char[] s, boolean FindYs)

{

//store the number of vowels found

int VowelCount = 0;

char[] Vowels;

int[] vowelIndexes = new int[s.length];

if(FindYs) vowels = {'a','e','i','o','u','y'};

else vowels = {'a','e','i','o','u'};

for(int si = 0; si < s.length; si++)

{

for(int vi = 0; vi < vowels.length; vi++)

{

if(vowels[vi]== s[si])

{

vowelIndexes[VowelCount] = si;

VowelCount++;

}

}

}

int[] returnarray = new int[Vowelcount];

for(int i = 0; i < VowelCount; i++)

returnarray[i]=vowelindexes[i];

return returnarray;

}

Is this a C-program?

#include<stdio.h>

#include<conio.h>

int main()

{

char ar[20];

int vowc=0,i;

printf("Enter the array\n");

gets(ar);

for(i=0;i<20;i++)

{

switch(ar[i])

{

case 'a' :

case 'A' :

case 'e' :

case 'E' :

case 'i' :

case 'I' :

case 'o' :

case 'O' :

case 'u' :

case 'U' :

vowc++;

break;

default : break;

}

}

printf("%d",vowc);

return 0;

}

This answer is:
User Avatar

User Avatar

Wiki User

14y ago

#include <stdio.h>

RemoveVowels (char *str) {

char *new = str;

while (*str != '\0') {

if (tolower(*str) != 'a' && tolower(*str) != 'e' && tolower(*str) != 'i' && tolower(*str) != 'o' &&

tolower(*str) != 'u') *(new++) = *str;

str++;

}

*(new) = '\0';

}

int main (int argc, char**argv) {

if (argc > 1) {

RemoveVowels (argv[1]);

printf ("%s\n", argv[1]);

return 0;

}

return 1;

}

This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Write a c program to find vowels in a character array?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

Write a program that stores vowels in an array When you program is given a character it should indicate whether the character is vowel or not?

That's easy to do!This script will get the POST data from an HTML form and check if it is a vowel.


How do you count the vowels in a string using PHP?

build an array of vowels then do a foreach on the array and then explode the string on the array value and the answer is -1 of the result


How do you write a C Program to fill up an Integer Array?

Reference:cprogramming-bd.com/c_page1.aspx# array programming


How do you write a program to read set of numbers using by an array and display the ascending order of the given input numbers?

To write a C++ program to display the student details using class and array of object.


Could you Write a program for 8086 microprocessor that displays on the monitor the average of 2 numbers from an array?

How to write a program for mouse in microprocessor?


Can you give an example of array using character variable in c program?

the example of array over charcter variables is char ["string"]


How do you write an assembly language program to find the sum of n numbers using array?

write an assembly language program to find sum of N numbers


How do you write a program in C to find and display the sum of each row and column of a 2 dimensional array of type float?

array type


Write a c program to find the maximum value of 25 element in an array?

int findMax(int *array) { int max = array[0]; for(int i = 1; i &lt; array.length(); i++) { if(array[i] &gt; max) max = array[i] } return max; }


Write a c program to find the maximum of two numbers and print out with its position?

maxValue = function (array) {mxm = array[0];for (i=0; i&lt;array.length; i++) {if (array[i]&gt;mxm) {mxm = array[i];}}return mxm;}; i don't know


Write a c program to reverse an array without using another array?

public static int[] reverseArray(int[] array) { int i = 0, j = array.length - 1; for (i = 0; i &lt; array.length / 2; i++, j--) { int temp = array[i]; array[i] = array[j]; array[j] = temp; } return array; }


Can you write a character into a specific array index in c?

Yes, you can but the array must be char-type. ... int arraySize = 3;char myArray[arraySize]; ... for (intarrayIndex = 0; arrayIndex < arraySize; arrayInsex++) { cin >> myArray[arrayIndex]; //It will write three character (keys which you pressed) in myArray} ...