|C - PROGRAMMING
Facebook.com/wikitechy twitter.com/WikitechyCom © Copyright 2016. All Rights Reserved.
C PROGRAMMING – Programming Structure
C- programming is the structure oriented Programming language
in which the programs are compiled and run in a top down
approach.
Basic Structure of C- Programming:
|C - PROGRAMMING
Facebook.com/wikitechy twitter.com/WikitechyCom © Copyright 2016. All Rights Reserved.
Documentation section:
The documentation section defines the set of comment lines
(/* */) or ( // ). For example, it might be the name of the program
or author and other details for feature reference we can define this
section.
Syntax:
Example:
/* Basic c- program structure */
Link section:
The link section provides instructions to the compiler to link
functions from the system library.
Syntax:
Common header files are
stdio- standard input /output function
conio- console input/output function
/*Multiple line comment */
// single line comment
#include <header file name.h>
|C - PROGRAMMING
Facebook.com/wikitechy twitter.com/WikitechyCom © Copyright 2016. All Rights Reserved.
math-contains math function like (cos(),sin(),sqrt(),abs()).
Example:
#include <stdio.h>
#include<conio.h>
Definition section:
In this definition section we can defines all symbolic constants.
Syntax:
Example:
#define pi 3.142
Global declaration section:
The global variable the variables that are used in more than one
function. Such variables are called global variables. And in general
we can call the global variable outside the function.
Syntax:
Example:
int x=10;
# define symbolic-name constant-value
Datatype variable name = value;
|C - PROGRAMMING
Facebook.com/wikitechy twitter.com/WikitechyCom © Copyright 2016. All Rights Reserved.
main () function section:
Every C-Program must have one main() function section and the
main function is divided into two parts they are
Declaration part
Executable part
Declaration part:
In this declaration part we declare all the variables that are used in
the executable part.
Syntax:
Example:
string x=”Wikitechy”;
Executable part
In this executable part section, the execution begins at the opening
brace and ends at the closing brace.
{ //Opening Brace
………
}; //Closing Brace
Datatype variable name = value;
|C - PROGRAMMING
Facebook.com/wikitechy twitter.com/WikitechyCom © Copyright 2016. All Rights Reserved.
The closing brace of the main function is the logical end of the
program. All statements in the declaration and executable part
ends with a semicolon.
Subprogram section:
The subprogram section contains all the user-defined functions
that are called in the main () function.
User-defined functions are generally placed immediately after the
main () function, although they may appear in any order.
main()
{
………
function name();
}
Subprogram function name()
{
………
}