How to convert char to ascii value in C

1 Answer

0 votes
#include <stdio.h>

int main() 
{                       
    char ch = 'a';
    printf("%d\n", (int)ch);
	printf("%d\n", ch);
		
	int n = (int)ch;
    printf("%d\n", n);
        
    return 0; 
} 
     
     
     
/*
run:
     
97
97
97
     
*/

 



answered Nov 27, 2019 by avibootz

Related questions

1 answer 173 views
173 views asked Nov 27, 2019 by avibootz
1 answer 188 views
188 views asked Nov 27, 2019 by avibootz
1 answer 197 views
197 views asked Nov 27, 2019 by avibootz
1 answer 201 views
2 answers 252 views
1 answer 195 views
195 views asked Nov 30, 2019 by avibootz
1 answer 186 views
186 views asked Nov 30, 2019 by avibootz
...