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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!