How to find cube of a number using macro in C

1 Answer

0 votes
#include <stdio.h>

#define CUBE(x) (x * x * x)

int main()
{
    int num = 9;

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

    return 0;
}



/*
run:

CUBE(9) = 729

*/

 



answered Apr 19, 2022 by avibootz

Related questions

1 answer 161 views
1 answer 106 views
1 answer 138 views
1 answer 122 views
1 answer 150 views
1 answer 139 views
...