If you want C++, the solution is simple, since you can use the container classes from the Standard Template Library (STL). Declare your variable like this:
std::vector<std::string> > lines;
and it will store a variable number of lines of unspecified length. The classes will take care of allocating memory for you.
If you want C only, you need to set up and maintain a data structure of unknown dimensions yourself. As you stated you're just a beginner, I'd rather spare you the details unless the C++ solution is really not an option.
With regard to reading lines from a file, there are functions for both C and C++ to read entire lines of text from a file. Just let us know what language you use (and whether you actually need help with the reading functions)
After reading over solution 2 (and commenting on it), I felt that I should add this:
Your task really has three aspects that you will need to solve:
1. Store an unknown number of values (lines) into an array or list
2. Store a string of unknown length (one line) into a variable
3. Read lines of text from a text file
Try to solve each of these aspects separately, and tell us which of them you still have trouble with, so we can offer more specific help on that.