CSE Dept Engineering Topics List

with Example C Programs | Preprocessor Directives

Subject and UNIT: Programming in C: Unit I (d): Preprocessor Directives

A conditional directive is used to instruct the preprocessor to select whether or not to include a chunk of code in the final token stream passed to the compiler.

with Example C Programs | Preprocessor Directives

Subject and UNIT: Programming in C: Unit I (d): Preprocessor Directives

The #pragma directive is used to control the actions of the compiler in a particular portion of a program without affecting the program as a whole.

with Example C Programs | Preprocessor Directives

Subject and UNIT: Programming in C: Unit I (d): Preprocessor Directives

The #line directive enables the users to control the line numbers within the code files as well as the file name that appears when an error takes place.

with Example C Programs | Preprocessor Directives

Subject and UNIT: Programming in C: Unit I (d): Preprocessor Directives

As the name suggests, the #undef directive undefines or removes a macro name previously created with #define. Undefining a macro means to cancel its definition.

with Example C Programs | Preprocessor Directives

Subject and UNIT: Programming in C: Unit I (d): Preprocessor Directives

An external file containing function, variables or macro definitions can be included as a part of our program. This avoids the effort to re-write the code that is already written.

with Example C Programs | Preprocessor Directives

Subject and UNIT: Programming in C: Unit I (d): Preprocessor Directives

To define preprocessor macros we use #define. The #define statement is also known as macro definition or simply a macro. There are two types of macros:object-like macro and function-like macro

Programming in C

Subject and UNIT: Programming in C: Unit I (d): Preprocessor Directives

We can broadly categorize the preprocessor directives into two groups-conditional and unconditional preprocessor directives.

Programming in C

Subject and UNIT: Programming in C: Unit I (d): Preprocessor Directives

The preprocessor is a program that processes the source code before it passes through the compiler.

with Example C Programs

Subject and UNIT: Programming in C: Unit I (c): Decision Control and Looping Statements

The goto statement is used to transfer control to a specified label. However, the label must reside in the same function and can appear only before one statement in the same function.

with Example C Programs

Subject and UNIT: Programming in C: Unit I (c): Decision Control and Looping Statements

In C, the break statement is used to terminate the execution of the nearest enclosing loop in which it appears. We have already seen its usage in the switch statement.

with Example C Programs

Subject and UNIT: Programming in C: Unit I (c): Decision Control and Looping Statements

C allows its users to have nested loops, i.e., loops that can be placed inside other loops. Although this feature will work with any loop like while, do-while, and for, it is most commonly used with the for loop, because this is easiest to control.

with Example C Programs

Subject and UNIT: Programming in C: Unit I (c): Decision Control and Looping Statements

Iterative statements are used to repeat the execution of a list of statements, depending on the value of an integer expression. C language supports three types of iterative en statements also known as looping statements.