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
  • 133,132
  • 16
  • 183
  • 261
Lelouch Yagami
  • 159
  • 2
  • 10

0 Answers0