Author |
Topic: C Programming (Read 1726 times) |
|
Robert09
Newbie
Gender:
Posts: 4
|
|
C Programming
« on: Sep 17th, 2015, 1:04am » |
Quote Modify
|
Hi all. I have one question about C programming. Is it possible to multiply a char and an int? char hash = '#' int hashNumber = 3 hash * hashNumber Thanks
|
|
IP Logged |
|
|
|
towr
wu::riddles Moderator Uberpuzzler
Some people are average, some are just mean.
Gender:
Posts: 13730
|
|
Re: C Programming
« Reply #1 on: Sep 17th, 2015, 10:10pm » |
Quote Modify
|
The easiest way to find out is to try. C is quite happy to interpret a char as an 8-bit integer, so yeah, multiplying them is not a problem. Whether the result is what you'd expect is another question; the result will be different than if you try the same thing in python. C: http://goo.gl/RRsV1V Python: http://goo.gl/cvRfue
|
« Last Edit: Sep 17th, 2015, 10:15pm by towr » |
IP Logged |
Wikipedia, Google, Mathworld, Integer sequence DB
|
|
|
|