Home >Backend Development >C#.Net Tutorial >What does eof mean in c language
eof represents the end of file character in C language. In the while loop, EOF is used as the end-of-file mark. The file with EOF as the end-of-file mark must be a text file. In text files, data is stored in the form of character ASCII code values.
In C language, or more precisely in the C standard function library, it represents the end of file (end of file).
In the while loop, EOF is used as the end-of-file mark. The file with EOF as the end-of-file mark must be a text file. In text files, data is stored in the form of character ASCII code values. We know that the range of ASCII code values is 0~127, and -1 is impossible, so EOF can be used as the end of file mark.
Example:
C language, input multiple sets of data, two per line, and then output one result corresponding to each line. Question description: Find the sum of integers a and b.
Input:
The test case has multiple lines, each line contains the value of a and b.
Output:
Output multiple lines, corresponding to the results of a b.
Sample input: 1 2
## 15
Code example:
#include<stdio.h> int main() { int a,b,c; while(scanf("%d %d\n",&a,&b)!=EOF)//此处应用了EOF { printf("%d\n",a+b); } return 0; }
Related recommendations:
C#.Net development graphic tutorialThe above is the detailed content of What does eof mean in c language. For more information, please follow other related articles on the PHP Chinese website!