Link to home
Start Free TrialLog in
Avatar of Linky
Linky

asked on

converting a char to short, int, etc

I know a char is 1 byte, short is 2 byte, long 4 byte. The program I am writing stores data 1 byte at a time in an array. Now is there a way to take 2 bytes of data and convert it to a short? And is there a way to take a short and convert it to 2 1 byte chars and store them in a char[2] array?

C Code would help me. Thank you for your time.
ASKER CERTIFIED SOLUTION
Avatar of Kent Olsen
Kent Olsen
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Linky
Linky

ASKER

Unsigned values won't be a problem. Thank you.