Explain the difference between the local variable and global variable in c?



Explain the difference between the local variable and global variable in c?..

Answer / Vinay Kumar Katiyar

Local variables have their scope limited to the function or block where they are defined, while global variables can be accessed from any part of the program. Local variables are initialized each time the function is called, but global variables maintain their value throughout the entire execution of the program.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More C Interview Questions

1. Write a function to display the sum of two numbers in the following ways: By using (i) pass by value (ii) pass by address a. function with argument and with return value b. function with argument and without return value c. without argument , with return value d. without argument , without return value Note: Use pass by address.

1 Answers  


Explain what is a pragma?

1 Answers  


How pointer is different from array?

1 Answers  


What is the role of this pointer?

1 Answers  


What is hash table in c?

1 Answers  


Do pointers take up memory?

1 Answers  


Is c pass by value or reference?

1 Answers  


Given a number N, product(N) is the product of the digits of N. We can then form a sequence N, product(N), product(product(N))… For example, using 99, we get the sequence 99, 99 = 81, 81 = 8. Input Format: A single integer N Output Format: A single integer which is the number of steps after which a single digit number occurs in the sequence. Sample Test Cases: Input #00: 99 Output #00: 2 Explanation: Step - 1 : 9 * 9 = 81 Step - 2 : 8 * 1 = 8 There are 2 steps to get to this single digit number. Input #01: 1137638147

2 Answers  


WRITE A PROGRAM TO PRINT THE FOLLOWING OUTPUTS USING FOR LOOPS. A) * B) ***** *** * * ***** * * *****

2 Answers  


Bit swapping

2 Answers  


What language is c written?

1 Answers  


no consistent academics. how to answer the question

0 Answers  


Categories