buffer is only 10 chars long; you are trying to copy 1000 chars from it. This results in undefined behavior.
Edit: And, the line below; write a zero byte beyond the end of the storage since i = 1000 is past the end.
Hint: Lookup fgets and strcpy functions.Code:storage[i] = '\0';
This problem is likely designed to use fgets() and might be designed to use one of the str... functions.
Tim S.