When to use return function
Hey, im new to c++ when do I use the return 0; alot of people have told me after I am finished writing the program. Others have told me it is only under certain circumstances. What would these circumstances be?
int add(int i, int p)
{
return i + p;
}
#include <fstream>
#include <string>
#include <iostream>
int main()
{
std::ofstream fileRead;
std::string line;
fileRead.open("c:\\My Awesome Text File.txt");
if (!fileRead) {
std::cout << "Failed to open \"My Awesome Text File.txt\"\nClosing" << std::endl;
return 0;
}
/* process file like normal */
return 0;
}