首页 > 解决方案 > 使用回报(0)

问题描述

在 C 中有什么用return(0)?我编写了不使用它就可以正常工作的程序。请以简化的方式向我解释,因为我是 C 的初学者。如果答案很复杂,它可能会让我更加困惑......

#include <stdio.h>
#include <stdlib.h>

int main()
{
    float km, meter, feet, inch, cm;
    printf("Enter the distance(must be in km: \n");
    scanf("%f", &km);
    cm = 100000*km;
    inch = 39370.1*km;
    meter = 1000*km;
    printf("The distance between the cities in cm is %f \n", cm);
    printf("The distance between the cities in inches is %f \n", inch);
    printf("The distance between the cities in meters is %f \n", meter);
}

标签: c

解决方案


这就是说程序是成功还是失败。

您也可以使用return EXIT_SUCCESS;return EXIT_FAILURE;

您可以像这样检查退货:

在此处输入图像描述


推荐阅读