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 106 views
106 views asked Feb 8, 2024 by avibootz
1 answer 91 views
1 answer 137 views
137 views asked Jan 20, 2021 by avibootz
1 answer 323 views
323 views asked Aug 6, 2019 by avibootz
3 answers 110 views
110 views asked Mar 5, 2025 by avibootz
...