--- D De Villiers wrote: > > Isn't the line "x = 0x1234;" changing x to some > hexidecimal/octal value ? > (not y variable). I don't know C much (only Java and > alittle C#). >
Lennie - When you write 0x1234 in C (or C++, and probably also in Java), you are simply using hex notation to express the number. The same number could be expressed in any of the following ways: 0x1234 (hex) 011064 (octal) 1001000110100 (binary) 4660 (decimal) (Assuming I haven't made a typo.) When I wrote "x = 0x1234", I was trying to show that you can over-write the value of a variable if you are sloppy, and I was being very sloppy in my example. I later corrected my example, and Ben Combee gave a better example (since his example shows a more common way it can happen accidently). Here are those examples, in case you lost them: 1. This doesn't over-write anything because the compiler isn't that stupid (it just stores 8 bits in x): static UInt8 x, y, z; x = 0x1234; 2. This one will over-write something (usually y, but it depends on where the compiler stores stuff): static UInt8 x = 0; static UInt8 y = 0; static UInt16 z = 0x1234; MemMove(&x, &z, 2); 3. This will alter y if y is in memory right after the x array: static UInt8 x[2]; static UInt8 y; x[2] = 4; If any of this doesn't make sense to you, get a book on C. __________________________________________________ Do You Yahoo!? Send your FREE holiday greetings online! http://greetings.yahoo.com -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/tech/support/forums/
