[root@localhost lbin]# gcc -o division division.c
division.c:30:1: warning: no newline at end of file
The executable file division is runing successfully,just i want to know why there is the error 'no newline at the end of file' although i hit the <return> in the end of file 'after }' three times.
plz help me.
I used the pico editor to cut your text, and paste them into my RedHat 9 box. Then closed the editor, and it compiled just fine.
Maybe you are using vi and left something in there. Or Emacs left something. I dunno. Try cat division.c and see if you see any junk in the file.
I do think, however, it is poor program design on two occasions:
* You are using an integer for the division. per = (M+M+M) / 5 What happens if I enter in decimal numbers?
* You are asking for input on one line. Will the computer accept typo corrections? I would input them one line at a time, so that if I do typo, I can correct it without deleting too much. You also do not check to make sure I enter in 5 values. What happens if I only put in four?
Somewhere in the C compiler details it states that the code has to finish with a newline. Dev-Cpp's GNU compiler and some other compilers give a warning, not an error. Many IDEs put the new line in automatically.
Last edited by vegaseat; Jun 20th, 2007 at 9:36 pm.
No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
This thread is currently closed and is not accepting any new replies.