Topics
Introduction
Steps to Develop a Program
History of C
Where C Stands
Getting Started with C
Structure of a C program
Execution of C Program
C - Tokens
 

Structure of a C program


STRUCTURE OF A C PROGRAM      
   Let’s look at structure of a program
                  #include<stdio.h> /* Header File */
main ()                                /* starting function */
{                                        /* start of program */
 
--------
Statements;
--------
}                                        /* end of program */ 
  • There should be a main ( ) function somewhere in the program to determine where to start the executions.
  • Usually all C statements are entered in small case letters.
  • The group of statements in main ( ) are executed sequentially.
  • The left brace indicates the program opening.
  • The right brace indicates the program closing. 
  • In C language Comments are enclosed with /* -- */ means these statements won’t execute when the program is complied.  
A C program consists of one or more functions. Each function performs a specific task. A function is a group or sequence of C statements that are executed together.
            Every C program starts with a function called main(). This is the place where program execution begins. Hence, there should be main() function in every C program. The functions are building blocks of C program. Each function has a name and a list of parameters.
 
The following are some rules to write C programs
  1. All C statements must end with semicolon.
  2. C is case – sensitive. That is, upper case and lower case characters are different. Generally the statements are typed in lower case.
  3. A C statement can be written in one line or it can split into multiple lines.
  4. Braces must always match upon pairs, i.e., every opening brace ‘{‘ must have a matching closing brace ‘}’.
  5. A comment can be split into more than one line.
 REVIEW OF TERMS
The terms that follow will be used frequently throughout the C. you should be completely familiar with them.
  • Source Code: The text of a program that a user can read commonly thought of as the program. The source code is input into the C compiler.
  • Object Code: Translation of the source code of a program into machine code, which the computer can read and execute directly. Object code is input to the linker.
  • Linker: A program that links separately compiled modules into one program. It also combines the functions in the Standard C library with the code that you wrote. The output of the linker is an executable program.
  • Library: The file containing the standard functions that your program can use. These functions include all I/O operations as well as other useful routines.
  • Compile Time: The time during which your program is being compiled.
  • Run Time: The time during which your program is executing.


Website Maintained by : Gowtham


Today, there have been 15 visitors (23 hits) on this page!
 
About Me :
gowthambujji@gmail.com Contact : 9949541666
 
=> Do you also want a homepage for free? Then click here! <=