在C的主要功能:
void main(int argc, char **argv)
{
// do something here
}
Run Code Online (Sandbox Code Playgroud)
In the command line, we will type any number for example 1 or 2 as input, but it will be treated as char array for the parameter of argv, but how to make sure the input is a number, in case people typed hello or c?
当我写这篇文章时,编译并运行:
int x;
scanf ("%d", &x);
while (x!=4) {
scanf ("%d", &x);
}
Run Code Online (Sandbox Code Playgroud)
当插入char或小于4的double数时,它进入一个无限循环.
当插入大于4的double时,它会终止.
任何解释?