Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Functions With Arguments | Introduction to Functions
course content

Conteúdo do Curso

C++ Introduction

Functions With ArgumentsFunctions With Arguments

A function with a parameter (argument) is a function that has to work with an object from the outside the function.

Note

A function argument is a local variable created and exists only in the current function.

For example, let's create a function that divides any integer by 2:

To use such a function, you need to call it and pass an argument to it:

Here is an example:

cpp

main.cpp

You can pass multiple arguments to a function:

cpp

main.cpp

func(5, 7) – calling a function and passing arguments to it. Arguments are passed with commas (,). You can also pass arrays:

cpp

main.cpp

Tudo estava claro?

Seção 5. Capítulo 4
course content

Conteúdo do Curso

C++ Introduction

Functions With ArgumentsFunctions With Arguments

A function with a parameter (argument) is a function that has to work with an object from the outside the function.

Note

A function argument is a local variable created and exists only in the current function.

For example, let's create a function that divides any integer by 2:

To use such a function, you need to call it and pass an argument to it:

Here is an example:

cpp

main.cpp

You can pass multiple arguments to a function:

cpp

main.cpp

func(5, 7) – calling a function and passing arguments to it. Arguments are passed with commas (,). You can also pass arrays:

cpp

main.cpp

Tudo estava claro?

Seção 5. Capítulo 4
some-alt