Ask Question

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

a) Local - within that function

b) Within that file only

c) global

+5
Answers (1)
  1. 29 August, 11:09
    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 & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers