Find the error(s) in each of the following program segments, and explain how the error(s) can be corrected:

```
int sum(int x, int y) {
int result{0};

result = x + y;
}
```


Error: The function is supposed to return an integer, but does not.
Correction: Place a return result; statement at the end of the function’s body or de- lete variable result and place the following statement in the function:
```
return x + y;
```

Computer Science & Information Technology

You might also like to view...

Which of the following will you NOT see in the fields for document information?

A) LastSavedBy B) SaveDate C) Filename D) Filesize

Computer Science & Information Technology

In some languages, including JavaScript, the Case structure can test only for equality of values, not inequalities using ranges of numbers.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology

A SharePoint ________ is a special purpose list that is used to store files and information about those files

Fill in the blank(s) with correct word

Computer Science & Information Technology

Which of the following is used to replicate attacks during a vulnerability assessment by providing a structure of exploits and monitoring tools?

A. replication image B. assessment image C. penetration framework D. exploitation framework

Computer Science & Information Technology