Jan 16, 2014 #1 N Neyolight Full Member level 5 Joined Aug 29, 2011 Messages 306 Helped 3 Reputation 6 Reaction score 3 Trophy points 1,298 Location World Visit site Activity points 3,624 Hello All ! Ok so I am bit confused about how can I convert byte to int in C. So lets say we have a variable A in byte. How would I convert the value of A from byte to int. Thanks ! Neyo
Hello All ! Ok so I am bit confused about how can I convert byte to int in C. So lets say we have a variable A in byte. How would I convert the value of A from byte to int. Thanks ! Neyo
Jan 16, 2014 #2 barry Advanced Member level 7 Joined Mar 31, 2005 Messages 6,582 Helped 1,208 Reputation 2,428 Reaction score 1,439 Trophy points 1,393 Location California, USA Visit site Activity points 35,790 I=(int)A, right?
Jan 16, 2014 #3 N Neyolight Full Member level 5 Joined Aug 29, 2011 Messages 306 Helped 3 Reputation 6 Reaction score 3 Trophy points 1,298 Location World Visit site Activity points 3,624 barry said: I=(int)A, right? Click to expand... Is that it? I assumed it would be lot more complicated than that
barry said: I=(int)A, right? Click to expand... Is that it? I assumed it would be lot more complicated than that
Jan 16, 2014 #4 FvM Super Moderator Staff member Joined Jan 22, 2008 Messages 53,229 Helped 14,794 Reputation 29,875 Reaction score 14,318 Trophy points 1,393 Location Bochum, Germany Visit site Activity points 301,563 Refer to C language specifications. In an assignment, the type conversion will be performed automatically, there's not even a type cast required.
Refer to C language specifications. In an assignment, the type conversion will be performed automatically, there's not even a type cast required.
Jan 30, 2014 #5 embpic Advanced Member level 3 Joined May 29, 2013 Messages 742 Helped 80 Reputation 160 Reaction score 77 Trophy points 1,308 Location india Visit site Activity points 5,213 it will convert but range should be within 0-255 for unsigned char.
Jan 30, 2014 #6 barry Advanced Member level 7 Joined Mar 31, 2005 Messages 6,582 Helped 1,208 Reputation 2,428 Reaction score 1,439 Trophy points 1,393 Location California, USA Visit site Activity points 35,790 embpic said: it will convert but range should be within 0-255 for unsigned char. Click to expand... OP said it was a byte. So it could be 0-255 (unsigned) or -128/+127 if it's char.
embpic said: it will convert but range should be within 0-255 for unsigned char. Click to expand... OP said it was a byte. So it could be 0-255 (unsigned) or -128/+127 if it's char.