Integer to Character conversion in C
        Posted  
        
            by nthrgeek
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by nthrgeek
        
        
        
        Published on 2010-03-17T18:31:58Z
        Indexed on 
            2010/03/17
            18:41 UTC
        
        
        Read the original article
        Hit count: 188
        
Lets us consider this snippet:
int s;
scanf("%c",&s);
Here I have used int, and not char, for variable s, now for using s for character conversion safely I have to make it char again because when scanf reads a character it only overwrites one byte of the variable it is assigning it to, and not all four that int has.
For conversion I could use s = (char)s; as the next line, but is it possible to implement the same by subtracting something from s ? 
© Stack Overflow or respective owner