From: Ankit Jain <ankitjain1580@yahoo.com>
To: Venkatesh Joshi <joshiv@cisco.com>
Cc: linux prg <linux-c-programming@vger.kernel.org>
Subject: Re: shift operator
Date: Tue, 28 Sep 2004 06:24:49 +0100 (BST) [thread overview]
Message-ID: <20040928052449.87960.qmail@web52910.mail.yahoo.com> (raw)
In-Reply-To: <01c401c4a518$68c33c00$dc846840@apac.cisco.com>
well i am sorry i forgot to tell the var size.
in this case it is 2 byte int i.e signed
if it is 4 byte then this would be the query
i=1
i<<=31
i>>=31
i>>=1
what will be the value of i & why
also
i=1
i<<=30
i>>=30
i>>=1
what will be the value of i
--- Venkatesh Joshi <joshiv@cisco.com> wrote:
> This depends on the type of variable that "i" is -
> int, long etc.
> because that would decide the number of bits in "i".
>
> It also depends on whether "i" is signed or
> unsigned.
>
> read up K&R chapter 2 for more info.
> ----- Original Message -----
> From: "Ankit Jain" <ankitjain1580@yahoo.com>
> To: "linux prg"
> <linux-c-programming@vger.kernel.org>
> Sent: Tuesday, September 28, 2004 10:18 AM
> Subject: shift operator
>
>
> > hi
> >
> > well if somebody can explain this
> >
> > i=1;
> > i<<=15;
> > i>>=15;
> > i>>=1;
> >
> > also
> >
> > i=1;
> > i<<=14;
> > i>>=14;
> > i>>=1;
> >
> > what should be the result of both and why?
> >
> > thanks
> >
> >
>
________________________________________________________________________
> > Yahoo! Messenger - Communicate instantly..."Ping"
> > your friends today! Download Messenger Now
> > http://uk.messenger.yahoo.com/download/index.html
> > -
> > To unsubscribe from this list: send the line
> "unsubscribe
> linux-c-programming" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at
> http://vger.kernel.org/majordomo-info.html
>
> -
> To unsubscribe from this list: send the line
> "unsubscribe linux-c-programming" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at
> http://vger.kernel.org/majordomo-info.html
>
________________________________________________________________________
Yahoo! Messenger - Communicate instantly..."Ping"
your friends today! Download Messenger Now
http://uk.messenger.yahoo.com/download/index.html
next prev parent reply other threads:[~2004-09-28 5:24 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-09-28 4:48 shift operator Ankit Jain
2004-09-28 5:02 ` Venkatesh Joshi
2004-09-28 5:24 ` Ankit Jain [this message]
2004-09-28 6:37 ` Amit Dang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20040928052449.87960.qmail@web52910.mail.yahoo.com \
--to=ankitjain1580@yahoo.com \
--cc=joshiv@cisco.com \
--cc=linux-c-programming@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).