How to find sum of two numbers using macro in C

1 Answer

0 votes
#include <stdio.h>

#define SUM(x, y) (x + y)

int main()
{
    int a = 4, b = 13;

    printf("Sum(%d, %d) = %d\n", a, b, SUM(a, b));

    return 0;
}




/*
run:

Sum(4, 13) = 17

*/

 



answered Apr 19, 2022 by avibootz

Related questions

2 answers 385 views
2 answers 260 views
1 answer 123 views
123 views asked Apr 19, 2022 by avibootz
1 answer 108 views
1 answer 123 views
1 answer 154 views
1 answer 151 views
...