473,396 Members | 2,029 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

warning no new line at end of the file

#define NUMBEROFDICE 5
#include <stdio.h>
#include <stdlib.h>


void RollDice(int dice[])
{
int i;
for(i=0;i<NUMBEROFDICE;i++)
{
dice[i]=(rand() % 6)+1;
}
}
int main(void)
{
int dice[5];

RollDice(dice);
int i;
for(i=0;i<5;i++)
{
printf("%d/n",dice[i]);

}
return 0;
}
Sep 14 '19 #1
1 1167
dev7060
636 Expert 512MB
Simply put, a newline is required at the end of a source file to not mess up things. Here's what happens: The #include preprocessor directive adds the content of the included file to the current file as it is. For e.g.
If a file called abc.h has content:

Sample Data(no newline)

And another file say program.c includes this file as:

#include "abc.h"
#include "second.h"

It would literally mean:

Sample Data#include "second.h"

Now imagine if there's a comment at the end of abc.h file. Then program.c would be:

//Sample Data#include "second.h"

Here, the second include statement is no longer effective. Therefore, newline is added to avoid these. Most text editors automatically put it at the end of the last line.
Sep 14 '19 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

15
by: Simon | last post by:
I would like to create a very basic file upload add image form to add to my web site and to keep them in a "tmp" directory within my web hosting file manager once uploaded. I understand the basic...
5
by: Ben | last post by:
hi all, just wondering if it is possible to call a function that resides on external php file before any <html> tag?? i have a code that sets a cookie which needs to be called before <html> tag....
10
by: Nije Nego | last post by:
Does it make sense for w3c validator to issue warning when style is coded { padding: 0 0 0 10%; } It reads 0 as absolute. -- buy, bought, bye
3
by: Glenn Palomar | last post by:
Hi, I just migrated my application to VS2005 and I get 2 warnings saying: "Type of parameter 'app' is not CLS-compliant." "Return type of function 'AppInventor' is not CLS-compliant." Can...
2
by: jimb20 | last post by:
ive looked for this and the basic code for inputs but it doesnt have anything about this example: say my file looks like this ------------- yes no 1 14 -------------
1
by: charlyrosario | last post by:
I am using ksh to get one line csv file from the output of df -k. The only information i need is: File System Name and FS Usage Example: /,50,/usr,45,/var,43 All info in ONE line ...
1
by: jackbenimble999 | last post by:
Hello! Every time I open my application (written in MS 2003 after being converted from a previous edition), I get the message "This file may not be safe if it contains code that was intended to...
0
by: ruthyoung | last post by:
Since our organization accelerates business applications across the distributed enterprise, we require some D2D backup repository to accelerate file backup and recovery. Please suggest some...
3
by: headshot | last post by:
Hello Everybody I have a project ALT with C++ program. After build , I get some of warning in file Bhonew.def http://no2.upanh.com/b6.s28.d3/8f0f9b71bda9242d4651aaeadbef9247_47258502.sshot1.png ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.