Only allocate dynamically using malloc and read parts providesa memory after the limit is reached.
demetrius.Bedn answered on June 10th 19 at 16:02
I tried using pointer, but it didn't work.
That have tried, did not work?
Rodger answered on June 10th 19 at 16:04
if the interest is academic, then as suggested by colleagues: malloc/calloc
if you need to work, take the glib (not to be confused with glibc)
if it is necessary to work, and glib is not satisfied (hard to imagine such a situation, but let's say), give more, for example, , but read only the first  (identity for example), scanf knows so. check how many was: if exactly 500 - user just entered a lot and most likely not fit all, swear at him (tell me that 256 was the max) and read again. if <500, then everything is OK, you can work. I hope it is clear explained: the main thing - not counting the data is larger than the allocated space (to avoid buffer overflow)