On Wed, Sep 17, 2008 at 6:26 PM, Sunil <[EMAIL PROTECTED]> wrote:

> Hi,
>
> This may not exactly be a kernel question, but giving a try.
>
> static variables if defined inside a function, it is defined once and
> retain values across function calls, so its like global variable in this
> sense. But it is not exposed to other functions and they can define local
> variable of the same name[or for that matter, there can also be a global
> variable of the same name, in which case most 'nearly defined' variable will
> be used].
>
> My query is, where is static variable stored ? in code section, in which
> case
>

The memory for static variables are stored in the data segment.


> this should be available to other functions too. On stack ? How is it
> managed ?
>

Make it global.

Static in itself is a storage class and its management is very well defined.

A simple google would yeild you:
http://en.wikipedia.org/wiki/Static_variable

Kindly do a first level search before posting a question to kernelnewbies, a
gentle suggestion.


>
> Thanks.
>
> -
> Sunil.
>
>

-- 
Regards,
Sandeep.






"To learn is to change. Education is a process that changes the learner."

Reply via email to