Which of the following is a proper declaration of an int type of function?Select one:a.addition( int i, int j )b.addition( int i, int j ){}c.int addition( int i, int j )d.int addition( int i, int j ){}
Question
Which of the following is a proper declaration of an int type of function?Select one:a.addition( int i, int j )b.addition( int i, int j ){}c.int addition( int i, int j )d.int addition( int i, int j ){}
Solution
The correct answer is d. int addition( int i, int j ){}
This is a proper declaration of an int type of function in C++ or similar languages. Here's why:
a. addition( int i, int j ) - This is not a proper declaration because it does not specify the return type of the function.
b. addition( int i, int j ){} - This is not a proper declaration because it does not specify the return type of the function.
c. int addition( int i, int j ) - This is almost correct, but it lacks the function body, which is represented by {}.
d. int addition( int i, int j ){} - This is a proper declaration of an int type of function. It specifies the return type (int), the function name (addition), the parameters (int i, int j), and includes an empty function body ({}).
Similar Questions
We would like to define a function that adds two numbers (x and y) together. Which of the following is the correct syntax to declare a function?A.def add(x, y):B.add function(x, y)C.def function add(x,y)D.add(x, y)
Which of the following is the correct way to call an “add” function with arguments 5 and 10 in C?add(10, 5);add(5, 10);add( 5 & 10);add(int 5, int 10);int add(5, 10);
Which of the following is a correct format for declaration of function?Question 7Answera.return-type function-name(argument type);b.return-type function-name(argument type){}c. return-type (argument type)function-name;d.all of the mentioned
Which one of the following declarations is correct?Select one:int long;char int;int length;float double;
Which of the following declaration is illegal?a.int a = 0, b = 1, c = 2; int array[3] = {a, b, c};b.int size = 3; int array[size];c.int size = 3; int array[size] = {1, 2, 3};d.In appropriate
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.