Find any errors in the following and explain how to correct them:

```
string& foo() {
string s("Hello");
... // other statements
return;
}
```


A value is not being returned from the function (i.e., the return statement should be return s;). The return type should be string not string&—reference returns are dangerous.

Computer Science & Information Technology

You might also like to view...

Which of the following is not a supported image format:

a) GIF b) TIF c) PNG d) JPEG

Computer Science & Information Technology

The primary key is an important field in an Access table. Please describe a primary key. Does Access create the primary key or can you create it yourself?

What will be an ideal response?

Computer Science & Information Technology

Case-Based Critical Thinking QuestionsCase 8-1Kyra is having a hard time opening a PowerPoint presentation she created. She asks her cousin Max, who is more experienced working with Office 2013 applications, to help her learn more about Office 2013. Kyra thinks she saved her file in the Documents library, but the file is not there. Max tells Kyra that ____.

A. she should check whether her flash drive is connected to the computer B. she should use the search feature to find the file C. the file may not have been saved D. the file was probably saved with the wrong extension

Computer Science & Information Technology

The vi command to repeat the last changes is

a: repeat b: rc c: . (dot) d: .. (dot dot) e: cw

Computer Science & Information Technology