I'm sorry that I find my way to flush input buffer is seriously wrong.
try this?
Code:
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
typedef struct Node {
char string;
struct Node * next;
}Node;
int main()
{
Node * curr, * head = NULL, * previous = NULL;
char line[100];
char *linep;
char ch;
char useless;
while((scanf("%[^\n]%c", line, &useless)) >= 2) /* %c to "eat" the '\n' */
{
linep = strdup(line); /* by the way, I can't make sure if it's necessary to "free(linep)" ? */
curr = (Node *)malloc(sizeof(Node));
curr->string = linep[0];
/* free(linep); */
if(head == NULL)
{
head = curr;
previous = curr;
}
else
previous->next = curr;
previous = curr;
}
curr->next = NULL;
curr = head;
while(curr)
{
ch = curr->string;
printf("%c", ch);
if(ch == 'a' || ch == 'A')
printf("*");
if(ch == 'e' || ch == 'E')
printf("*");
if(ch == 'i' || ch == 'I')
printf("*");
if(ch == 'o' || ch == 'O')
printf("*");
if(ch == 'u' || ch == 'U')
printf("*");
curr = curr->next;
}
return(0);
}