Starting Vocational Training From 1-May-2024 Get Detail


Example program for parameterized macro like function.


#include <stdio.h>

// Function to fund sum of two numbers
int sum (int a, int b)
{
    return (a + b);
}

// Function like Macro for above function 
#define SUM(a, b) (a + b)

int main()
{
    printf("SUM using function: %d
", sum(100, 200));
    printf("SUM using macro: %d
", SUM(100, 200));
    
    return 0;
}