#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 all parts is %d", ALL_PARTS * ALL_PARTS) ;
getch();
return(0);
}
在上面的代码中,FIRST_PART定义为7
LAST_PART定义为5
和ALL_PARTS初始化为FIRST_PART + LAST_PART(理想情况下为12)
但是当我打印ALL_PARTS时* ALL_PARTS给了我47作为输出!(但我认为答案是144)
请有人解释我怎么样?
答案 0 :(得分:1)
答案应该是47
FIRST_PART + LAST_PART * FIRST_PART + LAST_PART
MULTIPLICATION HAS MORE PRECEDENCE
SO 7 + 5 * 7 + 5
7 + 35 + 5
47