ONLINE LEARNING

c language

It's all about self learning.

C-CONSTANTS

C_CONSTANTS
12 August, 2016     
   "hello, dear"
"hello, \
dear"
"hello, " "d" "ear"
   Defining Constants
    There are two simple ways in C to define constants:
     1. Using #define preprocessor. 
     2. Using const keyword. 

        The #define Preprocessor
                Following is the form to use #define preprocessor to define a constant:


           #define identifier value	

        Following example explains it in detail:
                        #include <stdio.h>
         #define LENGTH 10   
         #define WIDTH 5
         #define NEWLINE '\n'
         int main()
           {
                 int area;
                 area = LENGTH * WIDTH; 
                  printf("value of area : %d", area); 
                  printf("%c", NEWLINE);
                   return 0;
            }
         value of area: 50

 
 
 

Get solution for your websites

logo