How to convert integer to char in C

1 Answer

0 votes
#include <stdio.h>
   
int main(int argc, char **argv) 
{ 
    int i = 7;
    char ch;
   
    ch = i + '0';
    printf("ch = %c", ch); // 7
       
    return(0);
}
   
/*
  
run:
   
7
 
*/

 



answered Aug 6, 2015 by avibootz

Related questions

1 answer 209 views
209 views asked Feb 8, 2024 by avibootz
1 answer 182 views
182 views asked Jun 28, 2024 by avibootz
1 answer 221 views
221 views asked Jan 20, 2021 by avibootz
1 answer 425 views
425 views asked Aug 6, 2019 by avibootz
3 answers 254 views
254 views asked Mar 5, 2025 by avibootz
...