Introduction to Newbie Programmer Series Introduction to Computer The Computer Programming Language Setting up the Computer for Programming
 Lets Get Started !
Beginning C Programming Variables a Handbag ! Basic Variable types in C Basic Formatted Output Basic Formatted Input
Looping Repeating Concept Different Kinds of Loops Advanced concepts and trick with Loops
Operators, An Introduction Arithmetic Operators Relational Operators Logical Operators Bitwise Operators Miscellaneous Operators and Operators Precedence
 Controlling the Flow
Flow Charts Conditional Statements Using Goto and Label Break and Continue the loops Switch the Cases Some Practical Applications of Control Flow
 The program structure
The program Structure Functions More Concepts of Functions Scope of the Variables across functions How the C language itself Works ? Scope of the Variables across files Static Variables Auto and Register Variables #define PreProcessor Some more PreProcessors
 Arrays and Structures
Introduction to Arrays Arrays, some more Concepts Arrays, Cool Examples Structures Introduction Structure, Some more Concepts Structure, Some Examples
 File Management
Basics of File management in C Steps Involved with File Handling in C
Inside Logic Gates – The Electronic Logic Binary Number System Mathematical Reasoning
Newbie Programmer
full book coming soon
by Shubham Ramdeo

These are the Preprocessors of C language that can be used to make programming FUN !


Welcome to Newbie Programmer Series. In the last post (click here) We have discussed a preprocessor called #define. In this post, we will discuss some more of them. Well, this series is made for those who are absolutely new in the programming world. So to keep everything simple and easy, I would not go too deep into the language features. But to introduce you, I am discussing below some more preprocessors that you will find while reading some sources of C programs. So if you are new to this series, please go to index (click here) and read out all the previous parts so that you can easily understand what I am discussing below.


We have already discussed a lot of things about it here.


This preprocessor is used to include the files while building the program. And we are already used to with it. As before any program that is using "printf", we include the "stdio.h" file.
Its usage is simple :
 If you want to use the standard files of C (system libraries) which are placed somewhere in C's folder like stdio.h you can use :
#include < filename >
Or if you want to use a file, 
#include "filename in the source file directory"
Its like suppose you have a function in some file "xyz.c" and you want to use that function in your current file, just add => #include "xyz.c" And then you can use that function from xyz.c file to your current one. But don't worry we will discuss this later in detail.


In C language, there are MAY BE many things which are already defined. This #undef is used to remove that definition. Like in some of your code you have added :

#define PI 3.14

In some file, you want to use PI as 3 only. And this change is to be made in a particular file only. Then you can do something like this :

#undef PI     //this will remove its value
#define PI 3     //redefining new value

#ifdef #ifndef #endif

You can also use some conditional statements with preprocessing. like this :
Suppose you want to make a PI definition ONLY IF its not already defined, then :
#ifndef PI
#define PI 3.14
Suppose you want to change the value of PI only if its already defined.
#ifdef PI
#undef PI
#define PI 3
You can use #else and #elif as well but we will discuss it later. This post look small but
I will update this post and add the other ones later once we do some applications.
Because that will make this over complicated as we are very new. So we need to do some applications. In the next post, we will do some great application to learn how beautiful preprocessors are !


Please share this as much as you can so that we can get connected with more and more people who want to learn programming.

© Shubham Ramdeo

Site Map
© Shubham Ramdeo