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 196 views
196 views asked Nov 27, 2019 by avibootz
1 answer 207 views
207 views asked Nov 27, 2019 by avibootz
1 answer 213 views
213 views asked Nov 27, 2019 by avibootz
1 answer 220 views
2 answers 274 views
1 answer 211 views
211 views asked Nov 30, 2019 by avibootz
1 answer 199 views
199 views asked Nov 30, 2019 by avibootz
...