<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="https://script.spoken-tutorial.org/skins/common/feed.css?303"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>https://script.spoken-tutorial.org/index.php?action=history&amp;feed=atom&amp;title=Test%2FC2%2FTesting%2FEnglish</id>
		<title>Test/C2/Testing/English - Revision history</title>
		<link rel="self" type="application/atom+xml" href="https://script.spoken-tutorial.org/index.php?action=history&amp;feed=atom&amp;title=Test%2FC2%2FTesting%2FEnglish"/>
		<link rel="alternate" type="text/html" href="https://script.spoken-tutorial.org/index.php?title=Test/C2/Testing/English&amp;action=history"/>
		<updated>2026-04-28T19:42:33Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.23.17</generator>

	<entry>
		<id>https://script.spoken-tutorial.org/index.php?title=Test/C2/Testing/English&amp;diff=18075&amp;oldid=prev</id>
		<title>Ashwini: Testing</title>
		<link rel="alternate" type="text/html" href="https://script.spoken-tutorial.org/index.php?title=Test/C2/Testing/English&amp;diff=18075&amp;oldid=prev"/>
				<updated>2014-11-25T08:04:16Z</updated>
		
		<summary type="html">&lt;p&gt;Testing&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;Title of script:Preprocessor Directives in C&lt;br /&gt;
&lt;br /&gt;
Author:Ashwini Patil&lt;br /&gt;
&lt;br /&gt;
Keywords:Video tutorial, #include, #define, #if, #undef, #else, #endif&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
{| border=&amp;quot;1&amp;quot;&lt;br /&gt;
!width=&amp;quot;50%&amp;quot;| &amp;lt;center&amp;gt;Visual Cue&amp;lt;/center&amp;gt;&lt;br /&gt;
!width=&amp;quot;50%&amp;quot;| &amp;lt;center&amp;gt;Narration&amp;lt;/center&amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|Display Slide 1&lt;br /&gt;
|Welcome to the Spoken Tutorial on Preprocessor Directives in C&lt;br /&gt;
|-&lt;br /&gt;
|Display Slide 2&lt;br /&gt;
|In this tutorial, we will learn about&lt;br /&gt;
&lt;br /&gt;
* Preprocessor Directives&lt;br /&gt;
* #include&lt;br /&gt;
* #define&lt;br /&gt;
* #if&lt;br /&gt;
* #else&lt;br /&gt;
* #undefwith the help of examples.&lt;br /&gt;
|-&lt;br /&gt;
|Display Slide 3&lt;br /&gt;
&lt;br /&gt;
System Requirements&lt;br /&gt;
|For this tutorial I am using&lt;br /&gt;
&lt;br /&gt;
* Ubuntu Operating System version 11.10&lt;br /&gt;
* gcc  Compiler version 4.6.1 on Ubuntu&lt;br /&gt;
|-&lt;br /&gt;
|Display Slide 4&lt;br /&gt;
&lt;br /&gt;
Prerequisites&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
spoken-tutorial.org&lt;br /&gt;
|To follow this tutorial you should be familiar with  C tutorials.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
If not, for relevant tutorials please visit spoken hyphen tutorial dot org.&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|I will start with an introduction toPreprocessor Directives.&lt;br /&gt;
|-&lt;br /&gt;
|Display Slide 5-6&lt;br /&gt;
&lt;br /&gt;
Introduction&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
* The preprocessor Directivesmodifies a source file before compilation.&lt;br /&gt;
* All preprocessor Directivesbegins with a #symbol.&lt;br /&gt;
* It instructsCcompiler to do pre-processing before compilation.&lt;br /&gt;
* It makes the programs easier to read, modify and develop&lt;br /&gt;
* It makes the code portable and helps to customize the code.&lt;br /&gt;
|-&lt;br /&gt;
|Display Slide 7&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Syntax:&lt;br /&gt;
&lt;br /&gt;
#Preprocessor Directive&lt;br /&gt;
|There are different types ofPreprocessor Directives.&lt;br /&gt;
&lt;br /&gt;
1) Defining preprocessor directives.&lt;br /&gt;
&lt;br /&gt;
#define:This macro defines constant values.&lt;br /&gt;
&lt;br /&gt;
    Macro:Macro is a code block with a given name.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
To use the code block we have to use the name of the macro.&lt;br /&gt;
&lt;br /&gt;
       #undef:This is used to undefine the definedmacro&lt;br /&gt;
&lt;br /&gt;
Syntax:&lt;br /&gt;
&lt;br /&gt;
#Preprocessor Directive&lt;br /&gt;
|-&lt;br /&gt;
|Display Slide 8&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Syntax:&lt;br /&gt;
&lt;br /&gt;
#Preprocessor Directive &amp;amp;lt;header file&amp;amp;gt;&lt;br /&gt;
|2)Header Files inclusion&lt;br /&gt;
&lt;br /&gt;
       #include &amp;amp;lt;stdio.h&amp;amp;gt;:The functions and code ofstdio.h headeris included in the main program.&lt;br /&gt;
&lt;br /&gt;
Syntax:&lt;br /&gt;
&lt;br /&gt;
#Preprocessor Directive &amp;amp;lt;header file&amp;amp;gt;&lt;br /&gt;
|-&lt;br /&gt;
|Display Slide 9&lt;br /&gt;
|3)Conditional compilation&lt;br /&gt;
&lt;br /&gt;
       Check for condition before compilation&lt;br /&gt;
&lt;br /&gt;
       #ifdef:This checks whether a macro is defined in the program or not.&lt;br /&gt;
&lt;br /&gt;
           If yes then the if clause is statements are added in the program.&lt;br /&gt;
&lt;br /&gt;
       #else:If the macro is not defined the else part is added.&lt;br /&gt;
&lt;br /&gt;
       #endif:This ends the preprocessor conditions.&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|Let us go through an example code.&lt;br /&gt;
|-&lt;br /&gt;
|Point to the filename.&lt;br /&gt;
|Note that our filename isarea.c&lt;br /&gt;
&lt;br /&gt;
In this program, we will calculate the area of a circle.&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
&lt;br /&gt;
#define radius 15&lt;br /&gt;
&lt;br /&gt;
#define pi 3.14&lt;br /&gt;
|Here we have defined a constant value for radiusand pi using#define keyword.&lt;br /&gt;
&lt;br /&gt;
Then we calculate the area of the circle and print the result.&lt;br /&gt;
|-&lt;br /&gt;
|Type:&lt;br /&gt;
&lt;br /&gt;
gcc area.c -o area&lt;br /&gt;
&lt;br /&gt;
./area&lt;br /&gt;
|Let us execute the program.&lt;br /&gt;
&lt;br /&gt;
On the terminal.&lt;br /&gt;
&lt;br /&gt;
Type:&lt;br /&gt;
&lt;br /&gt;
gcc area.c -o area&lt;br /&gt;
&lt;br /&gt;
./area&lt;br /&gt;
|-&lt;br /&gt;
|Highlight Output&lt;br /&gt;
|The output is:&lt;br /&gt;
&lt;br /&gt;
Radius of circle : 15&lt;br /&gt;
&lt;br /&gt;
Value of pi : 3.140000&lt;br /&gt;
&lt;br /&gt;
Area of the circle : 706.500000&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|Now let us see an example onconditional directives.&lt;br /&gt;
&lt;br /&gt;
We will use the same example.&lt;br /&gt;
|-&lt;br /&gt;
|Type:&lt;br /&gt;
&lt;br /&gt;
#ifdef radius&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
close the brackets after the lastprintf statement&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
|I will add a few lines here.&lt;br /&gt;
&lt;br /&gt;
In main function type:&lt;br /&gt;
&lt;br /&gt;
#ifdef radius&lt;br /&gt;
&lt;br /&gt;
(opening bracket) {&lt;br /&gt;
&lt;br /&gt;
close the brackets after the lastprintf statement&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
|-&lt;br /&gt;
|type:&lt;br /&gt;
&lt;br /&gt;
#else&lt;br /&gt;
&lt;br /&gt;
{&lt;br /&gt;
&lt;br /&gt;
   printf(“Radius of the circle is not defined”);&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#endif&lt;br /&gt;
|Now after the closing bracket type:&lt;br /&gt;
&lt;br /&gt;
#else&lt;br /&gt;
&lt;br /&gt;
(opening bracket){&lt;br /&gt;
&lt;br /&gt;
   printf(“Radius of the circle is not defined”);&lt;br /&gt;
&lt;br /&gt;
(closing bracket)}&lt;br /&gt;
&lt;br /&gt;
#endif&lt;br /&gt;
|-&lt;br /&gt;
|On the terminal&lt;br /&gt;
|Click onSave.&lt;br /&gt;
&lt;br /&gt;
Let us execute again.&lt;br /&gt;
&lt;br /&gt;
On the terminal&lt;br /&gt;
&lt;br /&gt;
press the up-arrow key twice.&lt;br /&gt;
&lt;br /&gt;
Again press the up-arrow key twice.&lt;br /&gt;
|-&lt;br /&gt;
|Highlight the output&lt;br /&gt;
|We see the same output.&lt;br /&gt;
&lt;br /&gt;
Radius of circle : 15&lt;br /&gt;
&lt;br /&gt;
Value of pi : 3.140000&lt;br /&gt;
&lt;br /&gt;
Area of the circle : 706.500000&lt;br /&gt;
|-&lt;br /&gt;
|Comment&lt;br /&gt;
&lt;br /&gt;
//#define radius 15.&lt;br /&gt;
|Now come back to the terminal.&lt;br /&gt;
&lt;br /&gt;
Let us comment the second line&lt;br /&gt;
&lt;br /&gt;
//#define radius 15.&lt;br /&gt;
&lt;br /&gt;
Click onSave.&lt;br /&gt;
&lt;br /&gt;
On the terminal.&lt;br /&gt;
&lt;br /&gt;
Execute again.&lt;br /&gt;
|-&lt;br /&gt;
|Highlight Output&lt;br /&gt;
|We see,&lt;br /&gt;
&lt;br /&gt;
Radius of circle not defined.&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|Now let us see the use of#undef derivative.&lt;br /&gt;
&lt;br /&gt;
Come back to out program&lt;br /&gt;
&lt;br /&gt;
Now insideifcondition,I will undefine theradius.&lt;br /&gt;
&lt;br /&gt;
And redefine it with a new value&lt;br /&gt;
|-&lt;br /&gt;
|Type&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#undef radius&lt;br /&gt;
&lt;br /&gt;
#define radius 20&lt;br /&gt;
|Type:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
#undef radius&lt;br /&gt;
&lt;br /&gt;
#define radius 20&lt;br /&gt;
|-&lt;br /&gt;
|Highlight output&lt;br /&gt;
|Now click onSave.&lt;br /&gt;
&lt;br /&gt;
Let us execute on terminal.&lt;br /&gt;
&lt;br /&gt;
Press the uparrow key twice&lt;br /&gt;
&lt;br /&gt;
Again Press the uparrow key twice&lt;br /&gt;
&lt;br /&gt;
You can see the output as:&lt;br /&gt;
&lt;br /&gt;
Radius of circle : 20&lt;br /&gt;
&lt;br /&gt;
Value of pi : 3.140000&lt;br /&gt;
&lt;br /&gt;
Area of the circle : 1256.000000&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|This brings us to the end of this tutorial.&lt;br /&gt;
&lt;br /&gt;
Let us summarize.&lt;br /&gt;
|-&lt;br /&gt;
|Display Slide 13&lt;br /&gt;
&lt;br /&gt;
Summary&lt;br /&gt;
|In this tutorial we learnt,&lt;br /&gt;
&lt;br /&gt;
* Preprocessor Directives&lt;br /&gt;
* #include&lt;br /&gt;
* #define&lt;br /&gt;
* #if&lt;br /&gt;
* #else&lt;br /&gt;
* #undef&lt;br /&gt;
|-&lt;br /&gt;
|Display Slide 14&lt;br /&gt;
|As an assignment, write a program to calculate the factorial of a number.&lt;br /&gt;
&lt;br /&gt;
Define the number using#define keyword&lt;br /&gt;
|-&lt;br /&gt;
|Display Slide 15&lt;br /&gt;
|Watch the video available at the link shown below&lt;br /&gt;
&lt;br /&gt;
It summarises the Spoken Tutorial project&lt;br /&gt;
&lt;br /&gt;
If you do not have good bandwidth, you can download and watch it&lt;br /&gt;
|-&lt;br /&gt;
|Display Slide 16&lt;br /&gt;
&lt;br /&gt;
Spoken Tutorial Workshops&lt;br /&gt;
|The Spoken Tutorial Project Team&lt;br /&gt;
&lt;br /&gt;
Conducts workshops using spoken tutorials&lt;br /&gt;
&lt;br /&gt;
Gives certificates to those who pass an online test&lt;br /&gt;
&lt;br /&gt;
For more details, please write to&lt;br /&gt;
&lt;br /&gt;
contact@spoken-tutorial.org&lt;br /&gt;
|-&lt;br /&gt;
|Display Slide 15&lt;br /&gt;
&lt;br /&gt;
Acknowledgement&lt;br /&gt;
|Spoken Tutorial Project is a part of the Talk to a Teacher  project&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
It is supported by the National Mission on Education through  ICT, MHRD, Government of India&lt;br /&gt;
&lt;br /&gt;
More information on this Mission is available at:  http://spoken-tutorial.org\NMEICT-Intro&lt;br /&gt;
|-&lt;br /&gt;
|&lt;br /&gt;
|This is Ashwini from IIT Bombay.&lt;br /&gt;
&lt;br /&gt;
Thank you for joining.&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Ashwini</name></author>	</entry>

	</feed>