signed character output

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Shubhangi24
    New Member
    • Oct 2012
    • 20

    signed character output

    can anyone please answer me
    why the output of following code is -1?

    Code:
    int main()
    {
      signed char ch=255;
      printf("%d",ch);
    
     return 0;
    }
    Last edited by Rabbit; Apr 3 '13, 03:39 PM. Reason: Please use code tags when posting code.
  • r035198x
    MVP
    • Sep 2006
    • 13225

    #2
    What do you think is the reason? hint: What is the maximum for unsigned char on your compiler and what does your compiler documentation say will happen when you exceed it?

    Comment

    Working...