What are local and global variables?

Answer Posted / ashish

Local:-
These variables only exist inside the specific function that
creates them. They are unknown to other functions and to the
main program. As such, they are normally implemented using a
stack. Local variables cease to exist once the function that
created them is completed. They are recreated each time a
function is executed or called.

Global:-
These variables can be accessed (ie known) by any function
comprising the program. They are implemented by associating
memory locations with variable names. They do not get
recreated if the function is recalled.

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Define Array of pointers.

632


Linked lists -- can you tell me how to check whether a linked list is circular?

644


Explain what is the concatenation operator?

626


Program will then find the largest of three numbers using nested if-else statements. User is prompted to enter three numbers. Program will find the largest number and display it on the screen. All three numbers entered by the user are also displayed. If user enters 21, 33, and 5, the output should be as follows: You entered: 21, 33 and 5. The largest number is 33.

1012


Can you apply link and association interchangeably?

670






Explain spaghetti programming?

682


Write a program to reverse a given number in c?

597


What do you mean by c what are the main characteristics of c language?

565


How can you determine the maximum value that a numeric variable can hold?

634


Can I initialize unions?

591


How to find a missed value, if you want to store 100 values in a 99 sized array?

815


What does struct node * mean?

596


What is p in text message?

537


Why we write conio h in c?

563


What is dynamic variable in c?

562