I'm writing a piece of code for one of my classes which is supposed to take in a string from the user. It will store the string into an array and then it has to copy the array elements into a linked list. I then have to print each chars from the linked list that's not a vowel. I was going to just use a conditional if statement for this part but my issue is I don't know how to implement the code to go back to the first node and then cycle forward through them to reprint the chars. My code only prints me the char in the last node. Any pointers (pun?) lol
Also, I get this warning:
Undeclared function 'gets'; assuming 'extern' returning 'int'.
relating to my use of gets(xxx); but I can't figure out how to fix the warning so any ideas?
My code thus far below:
#define maxsize 500
struct node *next;
int main (void)
struct node* head = NULL;
struct node* temp;
head=(struct node*)malloc(sizeof(struct node));
do /*puts each char in the array into a node of the linked list*/
head->next=(struct node*)malloc(sizeof(struct node));
head->data = sentence[nodenum];
head->next = NULL;
printf("\n%c",temp->data); /*This only prints the last letter in the linked list. How to manipulate to go back through the nodes to print corresponding char into a string?*/