Re: Sharing static variables or function between source files.




"raxitsheth2000@xxxxxxxxxxx 写道:
"
Is this interview question ?

static is having File Scope. and lifetime up to prog End.

What do you mean by "Used" ? u may used by pointer and all but not
directly in different files.

Undoubtedly, static var can not be accessed directly in different
files. I meaned by using a pointer, we could access the var with some
limitations (such as readonly attribute).


--raxit sheth


.



Relevant Pages

  • Re: C free
    ... int *p; ... It's the dereferencing the dud pointer that causes UB, ... points to reaches the end of its lifetime. ... Reading a trap representation invokes undefined behaviour. ...
    (comp.lang.c)
  • Re: Garbage Collection - Stop Making Trash
    ... > you've got to be extra careful to manage lifetime issues. ... > can't just hand out a pointer to an object for fear it will be ... you've got to be even more careful to manage lifetime ... for fear they might be called at an inappropriate time. ...
    (comp.lang.cpp)
  • Re: doubt in USING POINTERS
    ... the purpose of the concept of "lifetime" is to describe the period ... even have a pointer to the object. ... the object may or may not produce undefined behaviour, ... duration suitable for those temporary objects returned by a function. ...
    (comp.lang.c)
  • Re: C free
    ... int *p; ... It's the dereferencing the dud pointer that causes UB, ... points to reaches the end of its lifetime. ... at the value of an indeterminate pointer invokes undefined behavior. ...
    (comp.lang.c)
  • Re: can u tell me the reason that y we get this types of outputs
    ... > prog 2: ... Adjacent string literals are concatenated by the compiler. ... implicitly converted to a pointer. ...
    (comp.lang.c)