Course Content
History of C Language
0/2
Basic Structure of C Program
0/1
Types of Errors
0/1
Language Fundamentals
0/1
Data Types and Modifiers
0/1
Programming with C Language
About Lesson

#include line in the above program is a reference to a special file called stdio.h (called the header file contains predefined programs for standard input and output functions).  Any statement starting with # is called preprocessor directive.

main() is the starting function which contains executable statements in between two curly braces { and }.  Curly brackets are used to group statements together as a function or in the body of loop.  Such group is called as compound statement or block.

Important points to remember:

  1. Every C program requires a main() function. Use of more than one main() is illegal. The place of main() is where the program execution begins.
  2. The Execution of the function begins at the opening brace and ends at the closing brace.
  3. C programs are written in lowercase letters. However uppercase letters may be used for symbolic names and constants.
  4. All the words in a program line must be separated from each other by at least one space or a tab, or a punctuation mark.
  5. Every statement must end with a semicolon.
  6. All variables must be declared for their type before they are used in the program.
  7. Compiler directives such as define and include are special instructions to the compiler, so they do not end with a semicolon.
  8. When braces are used in the program make sure that the opening brace has corresponding ending brace.
  9. C is a free form language and therefore proper form of indentation of various sections would improve the legibility of the program.

A comment can be inserted almost anywhere a space can appear. Use of appropriate comments in proper places increases the readability of the program and helps in debugging and testing.

You cannot copy content of this page