Meaning of MyVar >> 1

R

RF Emmerink

Hi,

A simple question:

What is the meaning of:

variable >> 1

Kind regards,

Roderik
 
E

Ema

RF Emmerink said:
Hi,

A simple question:

What is the meaning of:

variable >> 1


It's a right shift of 1 bit.

Think at the binary representation of the value of the variable and move
every bit of one step right.

If you have a char c = 2 (00000010)
when you make c >> 1 you obtain
1 (00000001)

Bye,
Ema
 
K

Kevin Easton

RF Emmerink said:
Hi,

A simple question:

What is the meaning of:

variable >> 1

Kind regards,

If variable is not negative, it's the same as variable / 2. If variable
is negative, then the result is implementation-defined.

- Kevin.
 
P

Peter Shaggy Haywood

Groovy hepcat RF Emmerink was jivin' on Tue, 15 Jul 2003 13:59:33
+0200 in comp.lang.c.
Meaning of MyVar >> 1's a cool scene! Dig it!
What is the meaning of:

variable >> 1

It means you need to read a C book.
Really! If you want help, OK. But this sort of question is answered
by every book on C ever written. This newsgroup is a great resource,
but it is not a C book. Consult your manual in future, when you have a
question like this. If there's something in it you don't understand,
*that's* when you should post here for clarification. But RTFM to
learn the language, please.

--

Dig the even newer still, yet more improved, sig!

http://alphalink.com.au/~phaywood/
"Ain't I'm a dog?" - Ronny Self, Ain't I'm a Dog, written by G. Sherry & W. Walker.
I know it's not "technically correct" English; but since when was rock & roll "technically correct"?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top