How to create a macro that calculate cube of a number in C

1 Answer

0 votes
#include <stdio.h>

#define CUBE(X) ((X) * (X) * (X))

int main()
{
    printf("%d\n", CUBE(3));

    return 0;
}




/*
run:

27

*/

 



answered Apr 11, 2022 by avibootz

Related questions

1 answer 113 views
113 views asked Apr 19, 2022 by avibootz
2 answers 200 views
1 answer 135 views
1 answer 137 views
1 answer 161 views
2 answers 299 views
...