Answer to Question #204896 in C++ for hassan

Question #204896

Use the following program to find the scope as mentioned below: #include using namespace std; int square( int y ); // function prototype int main() { int x = 0; for ( x = 1; x <= 75; x++ ) // loop yourrollno times cout << square( x ) << endl; // calculate square of x and output results } // end main // definition of function square int square( int y ) { return y * y ; } // end function square For the program, state the scope (either function scope, global namespace scope, block scope or function-prototype scope) of each of the following elements: a) The variable x in main. b) The variable y in square. c) The function square. d) The function main. e) The function prototype for square. 


1
Expert's answer
2021-06-09T07:42:59-0400

a) Function scope because it's declared inside a function

 b) Block scope

c) Global namespace scope

d) Global namespace scope

e) Function-prototype scope 


Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog