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 123 views
123 views asked Apr 19, 2022 by avibootz
1 answer 139 views
1 answer 123 views
1 answer 151 views
1 answer 141 views
2 answers 385 views
...