Convert any character to its ascii code

can we convert any character its ascii .
like, char c = ‘A’ ;
i want ouptut as 65 ( which is ascii of ‘A’ )

@mishrakishan082, ASCII codes are the numerical representation of a character, so you convert any character to its ascii code by simply type casting it to integer,
eg,
cout<<(int)(‘A’)<<endl; // output :: 65

or you can do ,
int val=‘A’;
cout<<val<<endl; // output :: 65