1

I was tinkering with a C++ program and I stumbled upon a really strange thing.

This code outputs 0:

#include<iostream>
using namespace std;

int main(){
    cout<<(1<<(32LL));
}

while this one outputs 1:

#include<iostream>
using namespace std;

int main(){
    long long int a=32;
    cout<<(1<<a);
}

Why is this?

0 Answers0