freelanceprogrammers.org Forum Index » C
plz clarify...
Joined: 24 Jan 2005
Posts: 2
plz clarify...
hi all...
Can anybody clarify the defference between following two?
#define NODE struct node
typedef struct node NODE;
First one is compiled by preprocessor, second one is compiled by compiler. Other than these is there any difference? Plz explain in detail...
thanks in advance
cheers
iqbal h a
Joined: 03 Feb 2005
Posts: 1
plz clarify...
"h a iqbal" <iqbal_h_a@...>
2005-01-31 10:19 AM
To:
Programmers-Town@yahoogroups.com
cc:
Subject:
(PT) plz clarify...
Classification:
>>hi all...
>> Can anybody clarify the defference between
following two?
>>
>> #define NODE struct node
>> typedef struct node NODE;
>>
>> First one is compiled by preprocessor,
second one is compiled by compiler.
>> Other than these is there any difference? Plz
explain in detail...
>>
>> thanks in advance
>>
>>cheers
>>iqbal h a
A macro definition is "text substituted" into
the code before compilation. This will make a difference in a scenario
like:
NODE* a, b;
If the #define is used, a will be of type "pointer
to struct node", while b will be of type "struct node".
Whereas, if the typedef is used, both a and b would be
of type "pointer to struct node".
Cheers,
Lenson
Joined: 04 Feb 2005
Posts: 1
plz clarify...
#define is a macro. Typedef gives a new name to the
existing dayatype. You cant use datatype names in
#define.
--- h a iqbal <iqbal_h_a@...> wrote:
> hi all...
> Can anybody clarify the defference between
> following two?
>
> #define NODE struct node
> typedef struct node NODE;
>
> First one is compiled by preprocessor, second one
> is compiled by compiler. Other than these is there
> any difference? Plz explain in detail...
>
> thanks in advance
>
> cheers
> iqbal h a
>
___________________________________________________________
ALL-NEW Yahoo! Messenger - all new features - even more fun!
http://uk.messenger.yahoo.com
All times are GMT
Page 1 of 1
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Freelace Website Designer - Customer web design and software building.
China Wholesale - Electronics Products
Character Studio - Tutorials and Help
China Wholesale - Electronics Products
Character Studio - Tutorials and Help







