So I have a Structures which looks like:
typdef struct Location{
int x;
int y;
char *name;
I need to read some number of structures(The number of structures that I need to read and store can be anything from 2 Structures to 100,000 structures or more) which must be dynamically allocated according to the input and they are read till 'EOF'. The other problem is that the name field in the structure can be of any length so I need to dynamically assign that space for name variable as per the input length.
I know that here I will have to use realloc and use a while loop till EOF. But I have no clue how to structure the Syntax in C to take this input. The following is an example of Standard Input.
[0,0] Lorem ipsum dolor sit adipiscing elit
[5, 0] amet, consectetur
[10, 0] adipiscing elit
[7, 0] Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium
So the number of this Programming