How to double a variable with bitwise shift left in C

1 Answer

0 votes
#include <stdio.h>

int main() {
    int num = 8;
    
    num = num << 1; 

    printf("%d\n", num);

    return 0;
}


/*
run:

16

*/

 



answered Mar 8, 2025 by avibootz

Related questions

1 answer 93 views
1 answer 91 views
1 answer 95 views
1 answer 93 views
1 answer 88 views
1 answer 81 views
1 answer 96 views
...