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.)
You might also like to view...
To overload the + operator, you would write a function called
A) overload +. B) operator +. C) function +. D) operator.overload(+). E) None of the above
Logic errors are easily identified when a program is compiled.
Answer the following statement true (T) or false (F)