Professional Documents
Culture Documents
Every c program consists of one or more sections. These sections shown in following figure.
Documentation section Suggested
Header file section
Optional
Global variable section Optional
Main() function section
{
Declaration part Essential
Executable part
}
Sub program section
{ Optional
User defined section
}
Documentation section (or) comment line section:
Documentation section contains
1) Name of the program 2) Name of the author and other information
In c-language comment line placed between the following below.
/* comments */
Ex: /* to write the addition of two numbers */
C Language not accepted multiple comment lines. Comments are written in the program
whenever it is necessary. Comments which are not executable statements.
Header files section (or) Link section: Header file section contains native function of C
Language. It is dynamically links during execution of a program. Header files are very important
for any programming language. The compiler immediately executes the header files before
compile the C Programming code.
They are commonly used header files in C STDIO stands for standard input and output
a) Include<stdio.h> b) Include<conio.h> CONIO stands for console input and output
Global variable section: Some variables are written before main () function. Then the variable is
called global variables. This section declares some variables that are used in more than one function.
These variables are called global variables. This section must be declares the outside all functions.
The scope of the variables entire program. Once we create a global variables entire program
whenever it is necessary.
For example PI value used in the program more functions. Then define the value of the PI
globally.
Syntax: #define variable name<constant value>
EX: #define PI 3.14
Main () function section: every C program has one main () function section. This function has two
parts.
(a) Declaration part: This part declares all the variables used in executable part.
(b) Executable part: The executable part has at least one statement.
Braces: The program execution begins at opening braces and ends at closing braces. All the
declaration statements and executable statements written in between the open and closing braces
only. Opening braces and closing braces should be balanced.
Sub program section: it contains all the user defined functions that are called by main function.
User defined functions are generally placed immediately after main function.
2) Write C Language character set?
A character denotes any alphabet, digit and special symbol used to represent information.
The character is then used to form words, numbers and expressions.
C Character se: a) alphabets i) lower case: a to z
ii) Upper case: A to Z
b) Numbers: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
c) Special symbols: #, {},[],<,>,;, \,/,|
d) White spaces: blanks, horizontal tabs, new line, form feed, carrier return
3) Explain the features of C Language?
1) Program written in C are very efficient and fast. This is due to variety of data types and
powerful operators.
2) C is powerful and flexible language which helps system developers to deliver various complex
tasks with easy. C is used for diverse projects as operating systems, word processors, graphics,
spreadsheets, and even compilers for other languages.
3) C is highly portable language. This means that a C program written for one computer system
can be run on another system with little or no modification.
4) C is easy to extend.
5) Writing C program with user defined functions makes program more simple and easy to
understand.
6) It is easy to debugging, maintenance and testing easier.
7) It is easy to learn
8) It is structured language
9) C is a middle language. Because it supports high level language features and low level
language features.
10) It can be compiled on a variety of computer platforms.
11)It produces efficient programs.
3) What is pseudo code and explain?
The pseudo code is neither an algorithm nor a program. It is an abstract form of a program. It
consists of English like statements which perform the specific operations. It is defined for an
algorithm. It does not use any graphical representation. In pseudo code, the program is represented in
terms of words and phrases, but the syntax of program is not strictly followed.
Advantages:
1) It is easy to write
2) It is easy to understand
3) It is easy to modify
Examples: write a pseudo code to perform the basic arithmetic operations.
Read n1, n2
Sum = n1 + n2
Dif = n1 n2
mult = n1 n2
Quot = n1/n2
Print sum, diff, mult, quot
End.
C DATA
TYPES