On Wed, 2008-09-17 at 18:26 +0530, Sunil wrote: [...] > This may not exactly be a kernel question, but giving a try. Yes, it's a pure C question. > 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 ACK. > define local variable of the same name[or for that matter, there can ACK. > also be a global variable of the same name, in which case most > 'nearly defined' variable will be used]. ACK. > My query is, where is static variable stored ? in code section, in Usually in the same segment as (default) global variables (as it is - from the lifetime's perspective identical). > which case this should be available to other functions too. On The code section is usually read-only mapped so that won't work (unless it is declared "const" etc. etc.). > stack ? How is it managed ? "available to other functions" has two different meanings here: - logical address: since other functions don't know the symbol of that variable, they can't access it directly. But you can pass a pointer to that variable e.g. as a result and so others may use it. - physical access: if one happens to know the address (e.g. through a pointer as mentioned above), of course one can access it. Bernd -- Firmix Software GmbH http://www.firmix.at/ mobil: +43 664 4416156 fax: +43 1 7890849-55 Embedded Linux Development and Services -- To unsubscribe from this list: send an email with "unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx Please read the FAQ at http://kernelnewbies.org/FAQ