C语言中的数字可以是int、long long、double、float、short int等,具体取决于您需要的精度。
我假设它是一个double(因为它包含所有其他类型:int、short、float等)。
使用scanf()时,根据此链接,
成功时,该函数返回成功填充的参数列表项数
如果您将字符串作为参数传递,则返回值将为0。因为没有检测到0个浮点数。
int b = scanf("%d", &i); // b = 1 if given an integer, 0 if it is a string