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 374 views
2 answers 244 views
1 answer 113 views
113 views asked Apr 19, 2022 by avibootz
1 answer 98 views
1 answer 112 views
1 answer 138 views
1 answer 110 views
110 views asked Jun 24, 2024 by avibootz
...