C语言——设置flag的优势

    flag在C语言中没有特定的含义,可是咱们通常将它做为标记使用。好比设立判断条件,或者做为跳出循环的依据。html 例如,判断素数中,设置flag标记,让咱们的程序可读性更佳。code #include<stdio.h> #include<math.h> int prime(int n) { int flag=1; //设置标记 for(int i=2; i<=sqrt(
相关文章
相关标签/搜索