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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started