程序无法输出
Cinderalla 圈内达人 2017-08-10 16:26:59
2314 4 0

--------------------Configuration: modi1 - Win32 Debug--------------------

Compiling...

program10.cpp

E:\C\3\program10.cpp(5) : error C2065: 'exit' : undeclared identifier

E:\C\3\program10.cpp(11) : warning C4508: 'main' : function should return a value; 'void' return type assumed

执行 cl.exe 时出错.


program10.obj - 1 error(s), 0 warning(s)


问题来自: 主函数的几种形式

共 4 个回答

    qqq 资深元老 助教 2458天前

    把完整代码贴上来。

    Cinderalla 圈内达人 2458天前

    回复 qqq

    #include <stdio.h>

    void print()

    {

    printf("Hello World\n");

    exit(0);

    }

    main()

    {

    print();

    printf("end\n");

    }


    最佳答案

    qqq 资深元老 助教 2458天前

    #include <stdlib.h>

    exit函数是包含在stdlib这个头文件里的,加上这一句就可以了。

    Cinderalla 圈内达人 2458天前

    回复 qqq:好的,非常感谢

您还没有登录,所以不能回复该问题
我要回复

  • 0

    点赞

  • 扫一扫分享朋友圈

    二维码

  • 分享

相关问题