+ 13

Can we use the features of writing character values for a given integer as in c in c++?

printf("%c",65);//outputs A in c printf("%d",'B');//outputs 66 in c without using typecast,is there other methods available in c++?

14th Oct 2017, 6:56 AM
Bijay Shah
Bijay Shah - avatar
1 Resposta
+ 3
#include <iostream> int main() { char x = 42; std::cout << +x << "\n"; // prints 42 std::cout << x << "\n"; // prints * }
14th Oct 2017, 7:56 AM
aklex
aklex - avatar