Ask Question
12 June, 10:02

Write a function addOne that adds 1 to its integer referenceparameter. The function returns nothing.

+1
Answers (1)
  1. 12 June, 13:48
    0
    void addOnefunction (int referenceparameter) {

    referenceparameter = referenceparameter + 1;

    }

    Explanation:

    The function is the block of the statement which performs the special task.

    Syntax:

    type name (parameter_1, parameter_2, ...) {

    statement;

    }

    first, we define the return type of the function like int which return an integer value, a float which returns decimal value or void which returns nothing.

    then, define the parameters in the function which takes the value from the calling function and then we can use that parameter in the statement.

    we can define any one of the parameters, there is no restriction for define the parameter.

    we create the function addOnefunction which return is void and declare the one parameter referenceparameter, integer type.

    then, add the parameter with 1 and store in the same parameter.

    For adding, we can use the operator '+'.

    like,

    referenceparameter = referenceparameter + 1;
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “Write a function addOne that adds 1 to its integer referenceparameter. The function returns nothing. ...” in 📘 Computers and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers