Yes.... As long as the long value is between 0-255 for<br>
unsigned chars:<br>
<br>
main()<br>
{<br>
unsigned char data;<br>
unsigned long daataa;<br>
<br>
data = 0;<br>
daataa = 257;<br>
data = daataa;<br>
printf ( "data = %d daataa = %d", data, daataa );<br>
}<br>
<br>
The result of the above will be:<br>
<br>
data = 1 daataa = 257<br>
<br>
If you want to convert long data into MORE than 1 char (ie<br>
an array of char) then a plain old C union is the way to<br>
go....
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.