Study of #define macros.

#include <stdio.h>

/* Creating a macro with arguments */
#define ABS(X) (X < 0 ? -X : X)

int main(void)
{
int num, val;

printf("\nEnter number :");
scanf("%d", &num);

val = ABS(num);

printf("\nAbsolute value of %d is %d", num, val);

return 0;
}

No comments:

Post a Comment

kiss on google ads if you are anonymous because your ip is trackable.thank you.

......from.admin