🛠️ C++ Functions
Functions are reusable blocks of code that perform specific tasks. C++ functions can either return values or just perform actions.
📚 Example: Void Function
Console output will appear here...
📚 Example: Function with Return Value
Console output will appear here...
💡 Tip: In C++, declare functions before main()
, or use a function prototype
if you want to define them after main()
.
🔧 Function Syntax Basics
void functionName()
— no return value
returnType functionName(parameters)
— returns a value
- Call a function by writing its name followed by
()
- Function parameters are declared inside the parentheses
📚 Example: Function Prototype
Console output will appear here...