Monday, December 31, 2018

Preprocessor Directives - Good Bye 2018, Welcome 2019


Example of Preprocessor Directives:

Following program shows example of use of #include and #define in the C program.

#include<stdio.h>
#include<Windows.h>
#define p printf
#define s Sleep

int main()
{
    int i;
    for(i=0; i<5; i++)
    {
p("..... Good Bye 2018 .....");
    s(500);
    system("cls");
    s(500);
    }
    
    for(i=0; i<5; i++)
    {
p("..... WEL COME 2019 .....");
    s(500);
    system("cls");
    s(500);
    }
    return 0;
}

Output of the program:

This program will blink five times 

..... Good Bye 2018 .....

and then blinks five times

..... WEL COME 2019 .....

Visit C Program Practicals Blog for more details.



1 comment:

  1. What can we use for header "#include" in Linux for the same ?

    ReplyDelete