Functions in C++ - Reading Assignment

  1. A function is a reusable sequence of statements designed to do a particular job/action that helps the code run and produce a particular result.

  2. The first function to run in a C++ program is main(){ }

  3. Return values are the type of value that is returned (to the calling function (aka caller)) from an executed called function.

  4. Nested functions are not allowed in C++. They must all be defined outside of a function before they can be called inside of one. You cannot define a function inside of another function.

1 Like
  1. A function is a reusable sequence of statements designed to do a particular job.
  2. The main function.
  3. The values that are returned by function.
  4. No.
1 Like
  1. A function is a reusable sequence of statements designed to do a particular job. They provide a way to split programs into smaller modular pieces. These module chunks are easier to organize, test and run than an entire program.
  2. All in a C++ programs first run the main() function
  3. A return value is the specific value returned from a function. When a return value statement is executed, the return value is copied form the function back to the caller.
  4. Nested functions are not allowed in C++; functions cannot be defined within another function.
1 Like
  1. A function is a reusable sequence of statements designed to do a particular job.
  2. int main ()
  3. The type of value that is being returned when a function is executed.
  4. No.
1 Like
  1. What is a function?

Function is is a reusable sequence of statements designed to do a particular job.

  1. What function is run first of all in a C++ program?

Main ()

  1. What are return values?

The value of the returned function

  1. Are nested functions allowed in C++?

Nested functions are not supported in C++

1 Like
  1. What is a function?
    A function is a reusable sequence of statements designed to do a particular job.

  2. What function is run first of all in a C++ program?
    In C++, the main function is always run first.

  3. What are return values?
    Return values are specific values called functions return to the caller functions when the former are finished running. An exception is void function which returns nothing.

  4. Are nested functions allowed in C++?
    Nested functions are not allowed in C++.

1 Like
  1. A function is a reusable sequence of statements designed to do a particular job.

  2. The function named main eg. int main()

  3. The return value is the value that is returned to the caller from another function.

  4. No, you need to define a new function on its own and from there it can be called into another function.

1 Like
  1. what is a function? A reusable sequence of statements designed to do a particular job
  2. main
  3. What are return values? Return values display what is stored in a defined variable.
  4. No, nested functions are not allowed in C++, functions cannot be defined within other functions, they must be defined outside the function.
1 Like

Return values are values returned from a function to the caller. :slight_smile:

1 Like
  1. A function is a series of statements executed in the order they are written.
  2. The main function is the first to run in all C++ programs.
  3. Return values are values produced when functions are called by other functions.
  4. Nested functions are not allowed, however functions can be called within other functions.
1 Like

Maybe you meant this right but stated a bit wrong. They are values returned by the function back to the calling function. :slight_smile:

I am glad you caught this! I did mean what you wrote here. I had to mentally visual this execution between functions to really understand it. Conceptually, it seemed a little inception-like to me. I think I understand though. Thank you for keeping me on my A-game heh :slight_smile:

  1. Function is a reusable seuence of statements, designed to do a particular job.
  2. main()
  3. The value(s) that function returns.
  4. No.
1 Like

[quote=“ivan, post:1, topic:3161”]

  • What is a function?
    a function is a reuseable sequence of staements designed to do a particular job.

  • What function is run first of all in a C++ program?
    main function

  • What are return values?
    results of function call

  • Are nested functions allowed in C++?
    no in main but a user designed function can call another function.

1 Like

1. What is a function?

A function is a reusable sequence of statements designed to do a particular job.

2. What function is run first of all in a C++ program?

The main function.

3. What are return values?

A value that gets returned back to the caller of the function. The type of data returned by a function is dependent on the type defined before the function name.

4. Are nested functions allowed in C++?

No, you would have to define the function at class level.

1 Like
  1. A function is a reusable piece of code designed to do a particular job.
  2. The first function in every C++ program is called main().
  3. A return value is the value that is sent back from a function call.
  4. No, nested functions are not allowed in C++.
1 Like
  1. Function is a collection of statements that are designed to do a specific task and, also provide us a way to split our programs into small, chunks that are easier to organize, test, and use.

  2. C++ program begins execution of function int main.

  3. The specific value returned from a function to the caller is called the return value.

  4. In C++ nested functions are not supported.

1 Like

1. What is a function?
A reusable sequence of statements designed to do a particular job.
2. What function is run first of all in a C++ program?
The first function ran is the main() function of the program.
3. What are return values?
The return value is the data that is returned by a function once it ends.
4. Are nested functions allowed in C++?
Nested functions are not allowed in C++.

1 Like
  1. A function is a reusable sequence of statements designed to do a particular job.
  2. function main()
  3. A value given back to the calling function.
  4. no
1 Like

1.) A function is a reusable sequence of statements designed to do a particular job.
2.) Every C++ program must have a function named ‘main’. This is where program starts execution when it is run.
3.) Return values are data returned by a function.
4.) Nested functions aren’t supported in C++.

1 Like