turbo c - How is the output 47? -


#include<stdio.h> #include<conio.h>    #define first_part 7 #define last_part 5 #define all_parts first_part+last_part  int main()   {     printf ("the square root of parts %d", all_parts * all_parts) ;     getch();     return(0); } 

in above code first_part defined 7

last_part defined 5

and all_parts initialized first_part+last_part (which ideally 12)

but when printing all_parts * all_parts giving me 47 output!(but thought answer 144)

please can explain me how ?

the answer should 47

first_part + last_part * first_part + last_part  multiplication has more precedence  7 + 5 * 7 + 5   7 + 35 + 5  47 

Comments

Popular posts from this blog

unity3d - Rotate an object to face an opposite direction -

angular - Is it possible to get native element for formControl? -

javascript - Why jQuery Select box change event is now working? -