Hi guys,
 
 
I have some doubt about Typedef and Swpping pointers..
 
Why we r using typedef for stucture...Ex.
 
typedef struct muthu{
int a;
int b;
}good;
 
void main()
{
good *a1;
 
a1= (good*) mallloc(muthu);
 
}
 
 
My question is y we are using typedef for structre is there any particular use?
 
 
2. How we can swap the pointer variable without third variable;
 
 
 
 
 
 


Paul Herring <[EMAIL PROTECTED]> wrote:

From: ashwin mittal [mailto:[EMAIL PROTECTED]
>--- [EMAIL PROTECTED] wrote:
>> --- In [EMAIL PROTECTED], srikanth

I replied to this post from the web, mistakingly thinking it was a
recent post, apologies for bringing it up again - I did ask the
moderator to delete instead of approve my post, however it seems to have
escaped...

>> poojary <[EMAIL PROTECTED]> wrote:
>> > main()
>> > {
>> > int i=5;
>> > printf("%d%d%d%d%d",i++,i--,++i,--i,i);
>> > }
>> >
>> > 
>> > what is the o/p and why?
>>
>> Output may be anything and it would be correct. See:
>> <http://www.eskimo.com/~scs/C-faq/q3.1.html> and the
>> next few questions.
>
>Hi all,
>
>The Printf _expression_ is compile from Right to left...

'compiled' maybe, if only because the compiler may go serially through
the file (though The Standard has nothing to say on the matter)

>So starting from right,
>i,
>--i,
>++i,
>i--,
>i++
>
>the sequence goes like this....
>
>So
>i = 5;
>--i = 4;
>++i = 5;
>i-- = 5;
>i++ = 4

This has nothing to do with whatever answer your instance of the program
comes up with.

>But the printf will display the output in that
>sequence in which it is demanded...
>i.e. from left to right...

No it isn't. The order of evaluation of the parameters to a function is
not defined. The comma separating parameters is not the comma operator,
it is merely a separator. The only thing that is guaranteed about the
expressions is t hat all of them will be evaluated by the time the
function (printf() in this case) is called.

The compiler and/or runtime is free to evaluate the parameters from the
left, right, or in any order that (to the untrained eye) doesn't make
any sense.

>i++,
>i--,
>++i,
>--i,
>i

So this is wrong. In the sense that this is not necessarily what will
happen.

>Accordingly the values are displayed as such...
>i.e
>4 5 5 4 5

However, that happens to be one of the correct answers. As would '42',
'Hello World' or formatting your hard drive. Try looking at the link I
suggested, and that you quoted.

--
PJH

If Windows is the solution, can we please have the problem back?
unknown





Alderley plc, Arnolds Field Estate, The Downs, Wickwar, Gloucestershire, GL12 8JD, UK
Tel: +44(0)1454 294556 Fax: +44 (0)1454 299272

Website : www.alderley.com  Sales : [EMAIL PROTECTED] Service : [EMAIL PROTECTED]

This email and its contents are confidential and are solely for the use of the intended recipient. If you are not the original recipient you have received it in error and any use, dissemination, forwarding, printing or copying of this email is strictly prohibited. Should you receive this email in error please immediately notify [EMAIL PROTECTED]

This email has been scanned for viruses, however you should always scan emails with your own systems prior to opening.









To unsubscribe : [EMAIL PROTECTED]





Do you Yahoo!?
Send holiday email and support a worthy cause. Do good.

To unsubscribe : [EMAIL PROTECTED]




Yahoo! Groups Sponsor
ADVERTISEMENT
click here


Yahoo! Groups Links

Reply via email to