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 104 views
104 views asked Feb 8, 2024 by avibootz
1 answer 87 views
1 answer 132 views
132 views asked Jan 20, 2021 by avibootz
1 answer 318 views
318 views asked Aug 6, 2019 by avibootz
3 answers 104 views
104 views asked Mar 5, 2025 by avibootz
...