How to find square of a number using macro in C

1 Answer

0 votes
#include <stdio.h>

#define SQUARE(x) (x * x)

int main()
{
    int num = 9;

    printf("SQUARE(%d) = %d", num, SQUARE(num));

    return 0;
}



/*
run:

SQUARE(9) = 81

*/

 



answered Apr 19, 2022 by avibootz

Related questions

1 answer 200 views
200 views asked Apr 19, 2022 by avibootz
1 answer 234 views
1 answer 214 views
1 answer 239 views
1 answer 228 views
2 answers 490 views
...