Can someone explain what is happening at every step? I know the final output is 140.5, but I am unsure why that is. What is happening at each line that is resulting in 140.5?
#define PI 3.1
#define calcCircleArea(r) (PI * (r) * (r))
#define calcCylinderArea(r,h) (calcCircleArea(r) * h)
int main() {
double i = calcCylinderArea(3.0,5.0 + 1); printf("%g", i);
}
calcCylinderArea(3.0,5.0+1)
(calcCircleArea(3.0)*5.0+1)
notice that it is not (5.0+1)
.
Problem begins here.
((PI*(3.0)*(3.0))*5.0+1)
((3.1*(3.0)*(3.0))*5.0+1)