The task I am trying to accomplish is take a string from the user and delete all of the vowels using pointers. The issue I am having is the code I currently have will not run and I am unsure why. I must use pointers for the assignment as well as bring delete the vowels in a different function. Thanks.
#include <stdio.h>
#include <string.h>
int main(void)
{
char *i, *ptr;
char string[50]
void delvow(char *ptr);
printf("Enter a sentence that is not more than 50 characters long: ");
scanf(" %s", &string);
ptr = string;
delvow(ptr);
printf("Your new sentence is: %s",string);
}
void delvow(char *ptr)
{
int i = 0, j, k;
printf("Sentence in delvow is: ");
int length = strlen(string);
while(string[i] != '\0')
{
for(j=0, j<(length-i); j++)
{
if(string[i+j] == 'A' || string[i+j] == 'a' || string[i+j] == 'E' || string[i+j] == 'e'
|| string[i+j] == 'I' || string[i+j] == 'i' || string[i+j] == 'O' || string[i+j] ==
'o' ||string[i+j] == 'U' || string[i+j] == 'u')
{
k=1;
continue;
}
else
{
break;
}
}
for(k = 1; k < length; k++)
{
string[k]=string[k+j];
}
i++
}
}