Computer Science, asked by Insanneeraj8784, 1 year ago

Which function definition will run correctly? select one:

a. int sum(int a, int

b.{return (a + b);}

b. int sum(int a, int

b.return (a + b);

c. none of the mentioned

d. int sum(a,

b.return (a + b);?

Answers

Answered by nisikant54
6

Which function definition will run correctly? select one:

a. int sum(int a, int

b.{return (a + b);}

b. int sum(int a, int

b.return (a + b);

c. none of the mentioned

d. int sum(a,

b.return (a + b);?

Answered by dreamrob
0

Q- Which function definition will run correctly?

a. int sum(int a, int b) {return (a + b);}

b. int sum(int a, int b) return (a + b);

c. none of the mentioned

d.     int sum(a, b.) return (a + b);

Answer- Option(a) is the correct answer.

int sum(int a, int b) return (a + b); is the function definition that will run correctly.

  • In C++, the correct way to declare the function is:
  1. return_type function_name(parameter){Body of the function; }
  • Option(a) is the correct answer as it is correctly declared.
  • In option(b), the body of the function is not in block({})
  • In option(d), the body of the function is not in block({}) and data type of parameter is not declared.

#SPJ3

Similar questions