这是我的代码中的一个函数,我知道count循环是导致我的程序中断的原因.
第一个print语句将返回代码中先前设置的数字,但它永远不会打印下一个print语句hello
.
我不知道为什么它不起作用.有人能帮我吗?
//Function Declaration
int calc_digits(int number)
{
//Local Declaration
int count = 0; // the times the loop has ran
printf("%d", number);
fflush(stdout);
while (number != 0);
{
number /= 10;
count++;
}
printf("hello");
fflush(stdout);
return(count);
}
Run Code Online (Sandbox Code Playgroud)