Why is it silly to have a static declaration (such as static int count;) above the main function? (That is, why is it silly to have a global, static variable?)

What will be an ideal response?


A global variable remains in scope as long as the program is running. A static variable (is intended to be local) and it retains its value as long as the program is running. A global variable already retains its value, so there is no need to declare it static.

Computer Science & Information Technology

You might also like to view...

In a vector, which of the following statements is true?

a) Indexing vector access is range checked. b) The range of legal index values for a vector is 0 to the value of v.size()-1 c) To add a value use the member function v.push_front( ) d) To manage size of reserve use v.reserve(newReserve) e) To increase or decrease a vector’s size v.new_size(newSize);

Computer Science & Information Technology

Which of the following functions will create a pop-up input box?

A) toUpperCase() B) prompt() C) parseFloat() D) alert()

Computer Science & Information Technology

Which panels do you use to format text?

What will be an ideal response?

Computer Science & Information Technology

A(n) ____________________ is a journal posted on a Web site for public viewing and comment.

Fill in the blank(s) with the appropriate word(s).

Computer Science & Information Technology