+ 1

Can character divided by integer??

11th Oct 2018, 7:20 AM
Amirul Azim
Amirul Azim - avatar
5 Réponses
+ 3
Yeah you can, you don't have to convert it...it is automatically carried out by the compiler Compiler first converts your char value to the specific ASCII code related to that char variable after that it is being divided. Try it on your own.. YEAHH IT WORKS
11th Oct 2018, 8:25 AM
Rishabh
Rishabh - avatar
+ 2
Yes if you "convert" it to an integer
11th Oct 2018, 8:03 AM
KrOW
KrOW - avatar
+ 2
KrOW it's fine 🤨 (I dont mean that)
11th Oct 2018, 8:51 AM
Rishabh
Rishabh - avatar
+ 2
But care has to taken that while using %c specifier the integer value should not exceed 127. But for c++ it plays out a little different. Without a '+' operator character value is printed. ... So to conclude, in character arithmetic, typecasting of char variable to 'char' is explicit and to 'int' it is implicit.
14th Oct 2018, 5:37 AM
deepak sharma
deepak sharma - avatar
+ 1
Just for precision: i used the word "convert" dont for mean cast (that though the compiler do in automatic its always good to make clear on code) but only for said "you have to treat it like integer" because, logical speaking, its unuseful and illogical divide a char by an int
11th Oct 2018, 8:49 AM
KrOW
KrOW - avatar