Ask Question
21 October, 23:24

The scope of a variable declared inside of a function is:

a) Local - within that function

b) Within that file only

c) global

+2
Answers (1)
  1. 22 October, 00:34
    0
    The correct answer for the given question is option (a) i. e Local - within that function.

    Explanation:

    The variable which is declared inside any function are called as local variable The scope and lifetime of local variable is inside that block or function only.

    They cannot access outside the function.

    Following are the example of local variable

    #include / / header file

    void fun (); / / function prototype

    int main () / / main function

    {

    fun (); / /calling function

    print ("%d", t); / / it gives error because t is local variable cannot access in main function

    return 0;

    }

    void fun ()

    {

    int t=9; / / local variable

    printf ("t is local variable which value is:");

    printf ("%d", t);

    }

    As we seen that t cannot access outside the function. So correct answer is option (a)
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “The scope of a variable declared inside of a function is: a) Local - within that function b) Within that file only c) global ...” in 📘 Computers and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers