Question
write a C function that read a line from stdin and returns the text as a string. DO NOT use scanf or fget. THE ReadLine
write a C function that read a line from stdin and returns the text as a string.
DO NOT use scanf or fget. THE ReadLine function * should read the given input line of characters terminated by a newline * character (' ') into a dynamically allocated and resized buffer based on * the length of the given input line.
HINT initially dynamically allocate an array of char with size 10. Then, read data into that array character by charecter (e.g, you can use getchar()).
skeleton code below:
char *ReadLine() {
// write code here to read line from stdin and return it as a string DO NOT USE SCANF OR FGETS OR any other functions that reads into a static sized buffer
}
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