Ask Question

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

+1
Answers (1)
  1. 1 December, 23:25
    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 & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers