 | Discussion Forum |  |
|
|
assigning struct to variableNext Thread | Thread List | Previous Thread Start a Thread | Settings | Details | Message |
|---|
Read-Only Author Rock nMoon Posted 3-Jun-2002 22:35 GMT Toolset None |  assigning struct to variable Rock nMoon Hi All,,
Whats wrong with following ??
unsigned char myvar;
struct mystruct{ unsigned char aaa:3; unsigned char bbb:3; unsigned char ccc:2; }mystruct = {1,2,3};
myvar = mystruct;
Why is this assignment illegal ?? What is the way around , if any ??
Thankzz && Bye -Rocknmoon
| | Read-Only Author Andrew Neil Posted 4-Jun-2002 10:29 GMT Toolset None |  RE: assigning struct to variable Andrew Neil At the very least, you will need a type-cast.
Are you assuming that your struct is a single byte? Have you checked this: http://www.keil.com/support/docs/928.htm | | Read-Only Author Andrew Neil Posted 4-Jun-2002 10:30 GMT Toolset None |  RE: assigning struct to variable Andrew Neil "At the very least, you will need a type-cast."
Or, is a union what you really want? | |
Next Thread | Thread List | Previous Thread Start a Thread | Settings |
|