Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
| From | Eric Sosman <esosman@ieee-dot-org.invalid> |
|---|---|
| Newsgroups | comp.lang.c |
| Subject | Re: Swapping logic |
| Date | 2012-09-23 09:15 -0400 |
| Organization | A noiseless patient Spider |
| Message-ID | <k3n22b$tlf$1@dont-email.me> (permalink) |
| References | <49f36538-d5ca-411c-bc58-1f17b55911b6@s8g2000vbc.googlegroups.com> |
On 9/23/2012 8:48 AM, ZUBAIR TRALI wrote:
> #include<stdio.h>
> /*new logic for swapping*/
> #include<conio.h>
> void main()
> {
> int x=20,y=30;
> printf("nos before swapping are %d and %d\n",x,y);
> x=x*y/(y=x);
> printf("nos after swapping are %d and %d\n",x,y);
> getch();
> }
Wonderful![*] Splendid![*] You're a genius![*]
Unfortunately, my stupid computer misbehaves when I use
your brilliant technique with x=0. It even misbehaves when
both x and y are 50000 to start with (which ought to be
trivial to "swap"). Also, my compiler complains
foo.c:6: warning: operation on 'y' may be undefined
What am I[*] doing wrong?
[*] <http://dictionary.reference.com/browse/irony>
--
Eric Sosman
esosman@ieee-dot-org.invalid
Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Swapping logic ZUBAIR TRALI <bhat.zubair789@gmail.com> - 2012-09-23 05:48 -0700
Re: Swapping logic Richard Damon <news.x.richarddamon@xoxy.net> - 2012-09-23 09:04 -0400
Re: Swapping logic Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-09-23 09:15 -0400
Re: Swapping logic Noob <root@127.0.0.1> - 2012-09-24 12:56 +0200
Re: Swapping logic Casey Carter <Casey_at_Carter_dot_net@dontspam.me.invalid> - 2012-09-23 11:35 -0500
Re: Swapping logic Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-09-23 14:19 -0400
Re: Swapping logic Nobody <nobody@nowhere.com> - 2012-09-24 10:57 +0100
Re: Swapping logic Andrew Smallshaw <andrews@sdf.lonestar.org> - 2012-09-26 05:20 +0000
Re: Swapping logic Gareth Owen <gwowen@gmail.com> - 2012-09-26 06:46 +0100
Re: Swapping logic David Brown <david@westcontrol.removethisbit.com> - 2012-09-26 08:16 +0200
Re: Swapping logic Gareth Owen <gwowen@gmail.com> - 2012-09-26 17:51 +0100
Re: Swapping logic Kaz Kylheku <kaz@kylheku.com> - 2012-09-23 18:19 +0000
csiph-web