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

Can you apply link and association interchangeably?

682


What language is windows 1.0 written?

583


Why is sprintf unsafe?

623


Describe the order of precedence with regards to operators in C.

638


How can I handle floating-point exceptions gracefully?

640






write a program to rearrange the array such way that all even elements should come first and next come odd

1766


How does struct work in c?

617


how to introdu5ce my self in serco

1531


a=10;b= 5;c=3;d=3; if(a printf(%d %d %d %d a,b,c,d) else printf("%d %d %d %d a,b,c,d);

651


What are the uses of a pointer?

689


Why is not a pointer null after calling free?

600


#define f(g,h) g##h main O int i=0 int var=100 ; print f ("%d"f(var,10));} wat would be the output??

1547


how to make a scientific calculater ?

1570


Do you have any idea how to compare array with pointer in c?

612


Explain what will be the outcome of the following conditional statement if the value of variable s is 10?

754