Writing a macro to compare two numbers?

I want such a macro in my interview question final round i was rejected : compare(a, b) without using library function declare using macro program.

define c(a,b) (a>=b)?printf(“a is bigerthen b”):printf(“b is bigerthen a”)

#include<stdio.h> #define a 5 #define b 30 #define c(a,b) (a>=b)?printf(“a is bigerthen b”):printf(“b is bigerthen a”) int main() { c(a,b); return 0; }

Output: b is bigerthen a

Leave a comment