previous declaration of ‘function’ was here in C [duplicate]
http://www.kernel.org/doc/man-pages/online/pages/man3/getline.3.html getline already exists in stdio.h. That is why you are getting the error. Change the function name to something else like getline_my. Also, you are comparing a character with a string in line 16. It should beif(c == ‘\n’) NOT if(c == “\n”)