Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8204785
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T07:59:53+00:00 2026-06-07T07:59:53+00:00

In C when you do something like this: char var = 1; while(1) {

  • 0

In C when you do something like this:

char var = 1;

while(1)
{
  var = var << 1;
}

In the 8th iteration the “<<” operator will shift out the 1 and var will be 0. I need to perform a shift in order to mantain the bit shifting. In other words I need this:

initial —– 00000001

1st shift — 00000010

2nd shift – 00000100

3rd shift – 00001000

4th shift – 00010000

5th shift — 00100000

6th shift — 01000000

7th shift – 10000000

8th shift – 00000001 (At the 8th shift the one automatically start again)

Is there something equivalent to “<<” but to achieve this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T07:59:54+00:00Added an answer on June 7, 2026 at 7:59 am

    Yes, you can use a circular shift. (Although it isn’t a built-in C operation, but it is a CPU instruction on x86 CPUs)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

A while ago I asked myself, when I write something like this: char* first(int
Is that safe to do something like this: char* charArray = new char[10]; strcat(charArray,
I just discovered a bug where the code looked something like this: char *foo
Let's say I want to do something like this void my_printf(char *fmt,...) { char
I want to use something like this: char theArray[]=new char[8]; theArray= { 1,2,3,4,5,6,7,8}; instead
I have something like this: char *current_day, *current_time; system(date +%F); system(date +%T); It prints
I am using something like this: char *file; file = (char *)malloc(BUFSIZE * sizeof(char));
I have some code in my application that looks something like this: char *hash
I was just wondering whether it was possible to do something like this: char
I have something like this char string[]=My name is %s; printf(%s,string,Tom); I expect the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.