Programming In C, Structure of C, Preprocessor Directives

Question: Write the structure of C.

Ans: The format according to which a program is written is called the structure of program. The following is the structure of a C program.


Structure of C Language

Structure of C Language


Question: What are preprocessor directives? Describe its main types.

Ans: Preprocessor directives are instructions for the c compiler.

Every C language program contains preprocessor directives at the

beginning of the program. These directives start with number sign(#).

The most commonly used preprocessor directives are include and

define.

** The include Preprocessor Directives

When this preprocessor is carried out by the c compiler, it will search

for the header file that is written within the less than(<) and greater

(>) symbols and copy it into the source file.

In the above program the header file stdio.h is used.

The Define Preprocessor Directives

The define preprocessor is used for defining constants in c programs.

It directs the compiler to replace all the occurrences of one or more

variables in a program with specified constant.

It has the following syntax.

#define symbol value/expression.

It can be sued in a program as given below.

Volume = CUBE(side);

Comments

Popular posts from this blog

Conditional Control structure. Chapter 4, Lab Activities, Long questions.

Chapter # 5, Loop Control Structure, Lab Activities