I know it looks like a stupid question, but i really wanna know the reason.
Actually, i think it's because the c compiler will detect it as the end of file "EOF" of the program, but, am i wrong? because it compiles it anyway, but keep showing warnings like "no new line at the end of file".
Are you sure you mean an extra newline at the end of the file, as in, two? Or just one newline at the end of the file? One newline at the end of the file may look like an extra blank line but is really just one character. Many text editors won't even create a text file without at least one newline at the end of file.
Even gcc gives a warning about no newline at the end of the file(Not an error mind you, just a warning), it may be traditional/standard behavior. On one hand it's a stupid thing to be picky about, on the other hand it's a silly thing to quibble about either -- not hard to add one newline to one file once and be done with it.
Not that pointless IMHO. Several traditional Unix utilities are expecting all lines to be completed and will silently ignore the last one if unterminated. Also concatenating such C source files might break both their syntax and on screen readability.
This problem was mostly academic during decades when all the editors were correctly finishing every line by a new-line character but happens now from time to time with either automatically or exotic editor generated code.
Both the SunOS 4 compatible and the default Solaris sed implementations silently ignore a last unterminated line. The posix compliant sed version doesn't ignore the last line but complain about it: