1

In the 1st case o/p is 128 & 2nd case o/p is -128, why i am not getting same result?

#include <stdio.h>

int main()
{
    char x=1;
    printf("%d",x<<7);
    return 0;
}

O/P : 128

#include <stdio.h>

int main()
{
    char x=128;
    printf("%d",x);
    return 0;
}

O/P : -128

Sourav Ghosh
  • 130,437
  • 16
  • 177
  • 247

0 Answers0