Functions in C++
What is a Function?
A function is a block of code that performs a specific task and can be reused.
Why Use Functions?
- Reusability
- Clean code
- Easy debugging
Example
#include<iostream>
using namespace std;
using namespace std;
void greet() {
cout << “Hello”;
}
int main() {
greet();
return 0;
}
Types of Functions
- Built-in functions
- User-defined functions
