What are local and global variables?
Answers were Sorted based on User's Feedback
Answer / udayakumar
local variables are the variables which are declared with in
a function and the scope of that variables are only within
that function.Global variables are the variables which are
declared globally.Since it is declared globally it can
accessible to all the functions inside the program...
| Is This Answer Correct ? | 3 Yes | 0 No |
Answer / 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 |
local variable:-its uses inside the function that is these variable exist inside the function and other fu no access out side the main function.
while global variables are variables and which are declared both sides of function inside and outside that is globally.all functions can access out of main function.
| Is This Answer Correct ? | 1 Yes | 0 No |
What is the incorrect operator form following list(== , <> , >= , <=) and what is the reason for the answer?
what is the diff b/w static and non static variables in C. Give some examples plz.
what is object oriental programing?
Write a code to reverse string seperated by spaces i/p str=India is my country o/p str=aidnI si ym yrtnuoc After writing code, optimize the code
write a program in c to find out the sum of digits of a number.but here is a condition that compiler sums the value from left to right....not right to left..
What are the 4 types of programming language?
main() { int i; printf("%d",((i=1)*i-- - --i*(i=-3)*i++ + ++i)); } ans is 24 bt how?pls tell smbody............
with out using main how to execute the program?
What is the difference between null pointer and wild pointer?
What are the two forms of #include directive?
How can I find the modification date of a file?
What is time complexity c?