Re: confused about extern use



On Feb 21, 12:22 pm, Ian Collins <ian-n...@xxxxxxxxxxx> wrote:
Lalatendu Das wrote:

Here in the above example I am confused about, what extra the coder
going to achieve by declaring it as extern in the header file a.h.

So it can be used in another compilation unit.

Actually what u mean by another compilation unit. If my assumption is
not wrong do u mean If I will try to compile another C-program no need
to include this header file or what ?

I don't think so it will work in that case. And in any case if I have
to include this header file to define one variable of structure type
"abc" then why to declare it extern there.
Actually I might have some wrong notion, please explain through
example if u want to?
thanks for ur replay.
--
Ian Collins.


.



Relevant Pages

  • Re: External structs - newbie question
    ... Declaring it in a header file is the right way to go. ... You should declare it extern in the header, ... Below I've given an example layout for your header file. ... int main ...
    (comp.lang.c)
  • Re: confused about extern use
    ... Here in the above example I am confused about, what extra the coder ... going to achieve by declaring it as extern in the header file a.h. ...
    (comp.lang.c)
  • Re: confused about extern use
    ... going to achieve by declaring it as extern in the header file a.h. ... Actually what u mean by another compilation unit. ...
    (comp.lang.c)
  • Re: Global Instance
    ... seeing how you are declaring it would be helpful. ... description, it sounds like you are declaring it in the header file, which ... It should be extern in the header and declared in *one* C/C++ file. ... beitman AT applieddata DOT net ...
    (microsoft.public.pocketpc.developer)
  • Re: confused about extern use
    ... going to achieve by declaring it as extern in the header file a.h. ... Actually what u mean by another compilation unit. ...
    (comp.lang.c)