Results 1 to 3 of 3

Thread: Differe between static and global parameters

  1. #1
    Junior Member
    Join Date
    Feb 2007
    Answers
    13

    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

  2. #2
    Junior Member
    Join Date
    Feb 2006
    Answers
    8

    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.


  3. #3
    Junior Member
    Join Date
    Jun 2007
    Answers
    1

    Thumbs up 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
  •  
About us
Applying for a job can be a stressful and frustrating experience, especially for someone who has never done it before. Considering that you are competing for the position with a at least a dozen other applicants, it is imperative that you thoroughly prepare for the job interview, in order to stand a good chance of getting hired. That's where GeekInterview can help.
Interact