>Are there any alternate ways to make vowels a blank space?
Yes, there are countless ways. Here's another:
Code:
#include <ctype.h>
#include <stdio.h>
/* isvowel is a reserved name */
int is_vowel(int c);
int
main(void)
{
char buffer[BUFSIZ];
char ch;
size_t i = 0;
/* Read a string from standard input */
while ((ch = getchar()) != EOF && ch != '\n') {
buffer[i++] = ch;
if (i == sizeof buffer - 1) {
break;
}
}
buffer[i] = '\0';
printf("|%s|\n", buffer);
/* Replace vowels with spaces */
for (i = 0; buffer[i] != '\0'; i++) {
if (is_vowel(buffer[i])) {
buffer[i] = ' ';
}
}
printf("|%s|\n", buffer);
return 0;
}
int
is_vowel(
int c
)
{
c = toupper(c);
return c == 'A' || c == 'E' || c == 'I' || c == 'O' || c == 'U';
}