Defining Function-like Macros - C Preprocessor

C examples for Preprocessor:Macro

Description

Defining Function-like Macros

Demo Code

#include <stdio.h>

#define ABS(a)   (a) < 0 ? - (a)  : (a)

int main(void)
{
   printf("abs of -1 and 1: %d %d", ABS(-1), ABS(1));

   return 0;//from w ww. ja  v a  2 s.  com
}

Result


Related Tutorials