How to convert char to int in C++

1 Answer

0 votes
#include <iostream>

int main()
{
    char ch = 'c';
    
    int n = ch;
    
    std::cout << n;
    
    return 0;
}



  
/*
run:
  
c++
 
*/

 



answered Sep 20, 2021 by avibootz

Related questions

1 answer 171 views
3 answers 325 views
325 views asked May 16, 2021 by avibootz
1 answer 194 views
1 answer 199 views
199 views asked Feb 28, 2021 by avibootz
1 answer 272 views
272 views asked Jun 13, 2017 by avibootz
2 answers 229 views
229 views asked Apr 2, 2017 by avibootz
1 answer 190 views
...