Starting Vocational Training From 1-May-2024 Get Detail


How to define compile time constants using #define?


#include <stdio.h>

// Macro definition

#define COUNTRY "INDIA"  // String constant

#define TRUE 1 // Integer constant

#define FALSE 0 // Integer constant

#define SUM (10 + 20) // Macro definition

int main()

{

        printf("COUNTRY: %s ", COUNTRY);

        printf("TRUE: %d ", TRUE);

        printf("FALSE: %d ", FALSE);

        printf("SUM(10 + 20): %d ", SUM);

        return 0;

}