Question: / By default, we will read from stdin and write to stdout FILE *fin = stdin; FILE *fout = stdout; // Now we read lines
/ By default, we will read from stdin and write to stdout FILE *fin = stdin; FILE *fout = stdout; // Now we read lines from and print them in reverse order to // . node *head = NULL; // pointer to first node in linked list char *line = NULL; size_t linecap = 0; // Using a while-loop, read one line at a time from `fin' using getline. // After reading a line, allocate memory for a new node using malloc, // store `line' in the node, and insert the node at the beginning of the // linked list, then reset 'line' to NULL and linecap' to 0. // TODO // Finally, use a for-loop to walk through the linked list and print each // line to 'fout' using fprintf^. // TODO return 0;
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
