how to check if the input is a number or not in C?

前端 未结 8 2095
暖寄归人
暖寄归人 2020-11-27 05:38

In the main function of C:

void main(int argc, char **argv)
{
   // do something here
}

In the command line, we will type any number for ex

8条回答
  •  半阙折子戏
    2020-11-27 06:03

    Using fairly simple code:

    int i;
    int value;
    int n;
    char ch;
    
    /* Skip i==0 because that will be the program name */
    for (i=1; i

提交回复
热议问题