1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

#define directive

Discussion in 'C' started by persysweb, Mar 18, 2018.

  1. persysweb

    persysweb Member

    Joined:
    Aug 1, 2017
    Messages:
    98
    Likes Received:
    18
    Trophy Points:
    8
    Location:
    India
    Home Page:
    #define directive :

    #define is used for defining the constant value. In C language it is a directive which allows the definition of macros within source code.

    Syntax :
    Code:
    #define cname value
    
    #define age 10
    
    eg.
    Code:
      #include <stdio.net>
          #define name "24x7servermanagement.com"
          #define age 10
    
          int main()
          {
               printf("%s is over %d years.\n", name, age);
               return 0;
          }
    
    output :
    24x7servermanagement.com is over 10 years
     

Share This Page