For starters the code is bad formatted.
And as any bad formatted code it has a bug.
This statement
array[len + 1] = '\0';
can write outside the character array if the contained string does not contain a vowel.
For example consider the array
char array[] = "H";
The length of the stored string is equal to 1. So this statement
array[len + 1] = '\0';
is equivalent to
array[2] = '\0';
while the valid range of indices for this array is [0, 2).
The statement is just redundant and shall be removed because in this for loop
for (y = x; y < len; y++) {
array[y] = array[y+1]; // Moving the non-vowels to a higher position to fill up the array.
}
the terminating zero character '\0' is moved to the left as it is required.
Also instead of this long if statement
if (array[x] == 'a' || array[x] == 'e' || array[x] == 'i' || array[x] == 'o' || array[x] == 'u' || array[x] == 'A' || array[x] == 'E' || array[x] == 'I' || array[x] == 'O' || array[x] == 'U') {
you could use the standard function strchr as for example
unsigned char c = array[x];
c = tolower( c );
uf ( strchr( "aeiou", c ) != NULL ) {
//...
Pay attention to that it is an inefficient approach to move a whole sub-string to the left when a vowel is encountered.
As for your question then the conversion specifier s "matches a sequence of non-white-space characters.". That is as soon as a white space character after a sequence of non-white space characters is encountered the input is interrupted.
You should write
scanf( "%999[^\n]", array);
You could write a separate function that removes vowels from a string.
Here is a demonstration program.
#include <stdio.h>
#include <string.h>
#include <ctype.h>
char * remove_vowels( char *s )
{
const char *vowels = "aeiou";
char *start = s;
char *p = s;
do
{
unsigned char c = *s;
c = tolower( c );
if ( c == '\0' || strchr( vowels, c ) == NULL )
{
if ( p != s ) *p = *s;
++p;
}
} while ( *s++ );
return start;
}
int main( void )
{
char s[] = "Hello World";
puts( s );
puts( remove_vowels( s ) );
}
The program output is
Hello World
Hll Wrld