Consider the following pair of functions. You are to assume that the ellipses (. . .) contain correct code sufficient that it with the code you can see will compile apart from the two variables named sam in the two functions.

```
void func1( )
{
int sam;
. . .
}
void func2( )
{
int sam;
. . .
}
int main( )
{
func1();
func2();
. . .
```
a) This code will not compile because of the multiply defined variable sam. In the
explanation give the compiler message you get on compiling.
b) This code will compile just fine.
c) This code will compile but will give a runtime error due to the multiply defined
variable sam. In the explanation give the error message you get when this is run.
d) This code compiles and runs without any error messages. Explain why in the
explanations.


b) and d) are correct answers. The program will give correct results
(providing all the rest of the code is correct.)

Computer Science & Information Technology

You might also like to view...

Does rmdir(2) succeed? If so, what happens when the program tries to read the current directory?

Assume the following sequence of commands occurs in a program:

Computer Science & Information Technology

Discuss whether message passing or DSM is preferable for fault-tolerant applications.

What will be an ideal response?

Computer Science & Information Technology

________ messaging would be considered quicker than an e-mail conversation between two users

Fill in the blank(s) with correct word

Computer Science & Information Technology

The ________ dialog box is useful when data is imported on a routine basis

Fill in the blank(s) with correct word

Computer Science & Information Technology