-
Junior Member
Differe between static and global parameters
Hi
Can some explain me very clearly what is the difference between static and global parameters in C language?
Last edited by rpgubba; 06-04-2007 at 01:32 AM.
Reason: specifing the programing language
-
Junior Member
Re: Differe between static and global parameters
There is no such thing as a static parameter. There are static functions and static variables, but not static parameters (to functions).
A static function has visibility only within in the module. A static variable in a function retains its value after the function exits. A static variable a module scope retains its value through the life of the process and is initialized when the process starts.
Global (extern) is a variable that has visibility to all modules that are linked with that module. To use the global var in a module it has to be declared in an include file.
-
Junior Member
Re: Differe between static and global parameters
Global parameters can be accessed from other source files also using extern and they use global memory space, whereas Global static parameters cannot be used in other files and also are stored in the heap area and not on stacks or Global memory area. Whereas local static functions retain their values during funciton call and don't get destroyed even after function scope is over, they don't use stack rather they use heap memory.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules