beginers of c <ss*******@gmail.comwrites:
i have a binary number
1001 .i have to left shift it to 1 position
like 0011.if their any datatype or code is available to shift the
binary numbers
That's not a shift. It looks like you want to do a rotate operation.
C doesn't provide an operator to do that directly, but you can program
it.
Incidentally, if you'll try to use better punctuation and
capitalization, it will be helpful to those of us who are trying to
help you. Capitalize the word "I" and the first word of each
sentence. Leave a space or two after the "." at the end of each
sentence; don't leave a space before it.
For example:
I have a binary number 1001. I have to left shift it to 1 position
like 0011. If their any datatype or code is available to shift the
binary numbers.
The grammar and spelling are still a bit off, but we can overlook
that.
Also, what *exactly* do you mean when you say you have a binary number
1001? Do you have a 4-character string with the value "1001"? Do you
have an integer object whose value would be 1001 if expressed in
binary (9 decimal)? In C, integers are always stored in binary, but
the language has no notation for binary constants (it only has
decimal, octal, and hexadecimal).
Finally, let me suggest that you choose a more specific subject, so we
can tell what you're asking about. Everything here is (or should be)
"about c". A subject like "binary left shift" or "binary left rotate"
wold have been better.
Please don't take offense at these suggestions; they're intended to be
constructive, so we can help you more effectively.
--
Keith Thompson (The_Other_Keith)
ks***@mib.org <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <* <http://users.sdsc.edu/~kst>
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"