Quote from: Scorpiorus on Fri 07/05/2004 18:37:18function abs(int value) { if (value < 0) return = -value; else return value; }
Don't you mean:
function abs(int value) { if (value < 0) return -value; // no "=" here please! else return value; }
Quote
But bear in mind, you must not declare a string within the struct. Although, the compiler doesn't say anything it will lead to some serious errors, because strings are not supported within the struct!
Although, strings are actually just the same as char[200], which CAN be used inside structs.
QuoteQuoteI don't quite get the char and short variables, and what they are good for.Well, they just take less memory. But it also defines how large value each of them is able to store, for instance:
int -2147483648 through 2147483647 //really large values
short -32768....32767
char 0....255
Though, you should usually use the int type.
Unless faking strings in structs, of course...
I foudn out some interesting stuff my loading ROOMEDIT.CLB into a test editor. It was very handy for making the quick reference guide, but there were some other things too. For example:
#define function int
which means you can actually write things much more like C:
int abs (int value) {
if (value < 0) return -value; // no "=" here please!
else return value;
}
oh look... you don't need [ pre ] since the forum upgrade!