
The main function runs automatically when a C++ program is compiled and executed. Let’s assume the program is written inside a file called main.cpp. “.cpp” is the file extension for all C++ files just like HTML files have a “.html” extension.
int main{
}
Compile:
g++ main.cpp
Execute:
./a.out