wu :: forums
wu :: forums - C Programming

Welcome, Guest. Please Login or Register.
May 19th, 2024, 10:20am

RIDDLES SITE WRITE MATH! Home Home Help Help Search Search Members Members Login Login Register Register
   wu :: forums
   riddles
   cs
(Moderators: towr, Icarus, ThudnBlunder, william wu, Eigenray, Grimbal, SMQ)
   C Programming
« Previous topic | Next topic »
Pages: 1  Reply Reply Notify of replies Notify of replies Send Topic Send Topic Print Print
   Author  Topic: C Programming  (Read 1715 times)
Robert09
Newbie
*





   


Gender: male
Posts: 4
C Programming  
« on: Sep 17th, 2015, 1:04am »
Quote Quote Modify 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: male
Posts: 13730
Re: C Programming  
« Reply #1 on: Sep 17th, 2015, 10:10pm »
Quote Quote Modify 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
Pages: 1  Reply Reply Notify of replies Notify of replies Send Topic Send Topic Print Print

« Previous topic | Next topic »

Powered by YaBB 1 Gold - SP 1.4!
Forum software copyright 2000-2004 Yet another Bulletin Board