Студопедия.Орг Главная | Случайная страница | Контакты | Мы поможем в написании вашей работы!  
 

Comment Lines



A C source program consists of statements and comment lines. Comment lines are enclosed by the characters /* (at the start of the comment) and */ (at the end of the comment).

The Function main { }

Every C program must have a function called main which must appear only once in a program. The parentheses following the word main must be present, but there must be no parameters included. The main part of the program is enclosed within braces { }, and consists of declaration statements, assignment statements, and other C functions. In the above program there are six statements within the braces: a declaration statement (the first statement of the main program starting with the word float), two assignment statements (the fourth and fifth statements starting with the variable names d and average), and three function statements, two to print information on the screen and one to scan the keyboard for input.

As C is free-form language, the semicolon (;) at the end of each line is a must. It acts as a statement terminator, telling the compiler where an instruction ends. Free form means that statements can be identified and blank lines inserted in the source file to improve readability, and statements can span several lines. However, each statement must be terminated with a semicolon. If you forget to include the semicolon, the compiler will produce an error, indicating the next line as the source of the error. This can cause some confusion, as the statement objected to can be correct, yet as a syntax error is produced.





Дата публикования: 2015-09-17; Прочитано: 888 | Нарушение авторского права страницы | Мы поможем в написании вашей работы!



studopedia.org - Студопедия.Орг - 2014-2024 год. Студопедия не является автором материалов, которые размещены. Но предоставляет возможность бесплатного использования (0.006 с)...