Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Leer Type of Functions | Introduction to Functions
C++ Introduction
course content

Cursusinhoud

C++ Introduction

C++ Introduction

1. Getting Started
2. Introduction to Operators
3. Variables and Data Types
4. Introduction to Program Flow
5. Introduction to Functions

book
Type of Functions

When creating a function, the data type of the return value must always be specified. In the main function, the return type is declared as int, indicating that it will return an integer value upon completion. In most cases, the main function returns 0 to signify that the program has successfully executed.

cpp

main

copy
1234
int main() { return 0; }

Note

Since the main function is reserved in C++, it will always return integer.

Custom functions can return any value, but it's essential to understand that the type of the return value must match the specified return type in the function definition.

h

custom_function

copy
1234
___ custom_function() { return ___; }

Was alles duidelijk?

Hoe kunnen we het verbeteren?

Bedankt voor je feedback!

Sectie 5. Hoofdstuk 2
Onze excuses dat er iets mis is gegaan. Wat is er gebeurd?
some-alt