Question

    What is the scope of a variable declared as "static" inside a function?

    A It is local to the function and retains its value between function calls. Correct Answer Incorrect Answer
    B It is global and can be accessed from any part of the program. Correct Answer Incorrect Answer
    C It can only be accessed from within the same function. Correct Answer Incorrect Answer
    D It can only be accessed from within other static functions. Correct Answer Incorrect Answer

    Solution

    It is local to the function and retains its value between function calls.

    Practice Next

    Relevant for Exams: