tmp = 2/4;竟然没有发现的
我还纠结着单目运算符和双目运算符和乘除的一些优先级什么事情。
#include "common.h" #include <stdio.h> #include <stdlib.h> #include <math.h> //#define static float Mathematical_modeling = 0; static int capacitance_modeling = 0; static float value = 0; static char car = 'A'; static float bus_num = -1000.123; static int China_population = -100; static float x = 2.5, y = 4.7; static int a = 7; int main() { int tmp = 2 / 4; //x+y printf("类型转换is %f\n",x+a%3*(int)(x + y)%2/4); printf("tmp is %d\n", tmp); while (1) { getchar(); } return 0; }
一勤天下无难事。