which is true? i) global variable can't start auto variable ii)local variable are static iii)extern are auto variable iv) all the above And give the explanation
Answers
Answer:
a and b are called local variables. They are available only inside the function in which they are defined (in this case function_1()). If you try to use these variables outside the function in which they are defined, you will get an error. Another important point is that variables a and b only exists until function_1() is executing. As soon as function function_1() ends variables a and b are destroyed.The variable a created inside the compound statement or block i.e inside braces ({}) is completely different from variable a declared outside the block. As soon as the block ends the variable a declared inside the block is destroyedIn this case variables a and b inside function_1() are local to function_1(), while variables a and b inside function_2() are local to function_2(). They are entirely independent of each other. If you change the value of a inside the function_1() then it will not change the value of a inside the function_2()The variables declared outside any function are called global variables. They are not limited to any function. Any function can access and modify global variables. Global variables are automatically initialized to 0 at the time of declaration. Global variables are generally written before main() function.