return 結束當前函數
exit 結束整個進程,包含頭文件:#include <stdlib.h>
直接上代碼:
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
#include <string>
using namespace std;
void fun()
{
printf("in fun\n");
return ;
//exit(0);
}
int main()
{
fun();
printf("after fun\n");
system("pause");
return 0;
}
fun()函數中使用return: fun()函數中使用exit: