Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Problem with conversion int to char as ASCII value  RSS feed

 
Viktor Iurkov
Greenhorn
Posts: 6
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello everyone!
Asking for some help because i'm completely stuck on line #11. I hve no idea how to convert int to char, for example int 10 to char '10'.
 
Knute Snortum
Sheriff
Posts: 4073
112
Chrome Eclipse IDE Java Postgres Database VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you look at an ASCII chart you will see that ASCII '0' is dec 48. So adding 48 to 0 will give you '0'. Since chars are ints (kinda) you can add to them like a number.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!