A couple of things about your program, the variable c is a pointer to a string, but it has no memory assigned, if you want to use c as it is, you must use the malloc function.
The variable c is not updated inside the while loop, in effect c is a pointer and we can use pointer arithmetic to advance along the string.
The scanf () function, as it is written, will only read one character, and not a complete string,also keep in mind that scanf will only read up to the first blank space it finds, so your program would look something like this:
char *c = malloc(88);
char *temp = c;
printf("Enter your sentence - ");
int y = 0;
int x = 0;
while (*c != '\0')
if (*c == 'a' || *c == 'e' || *c == 'i' || *c == 'o' || *c == 'u' || *c == 'A' || *c == 'E' || *c == 'I' || *c == 'O' || *c == 'U')
printf("Vowels = %i Consonents = %i\n", x, y);
As with gets, it is very dangerous to use scanf to read strings, since scanf does not take into account the length of what is read and will allow the user to write more characters than the defined array (or the space allocated by malloc) in the program can admit. As a result, scanf will write the characters that no longer fit in the defined array in other memory portions that may contain other data that our program is using. This will lead to abnormal behaviors, memory leaks, etc.
There is indeed a memory leak, but we should not try free(c), because c points to zero at the end of the program, we should not try free() a pointer that points to zero (NULL) to we will have a problem with the program. Since you ask it, what to do?, the solution is simple, we will use a temporary pointer that points to the same memory address as c, and at the end of the program we free it, you can see the modified program.