sizeof — receiving the memory size of variable or array in bytes.
Description:
u8 sizeof (u8 var);
u8 sizeof (u8 *var);
Returns the memory size of variable or var array in bytes.
List of parameters:
var
Variable or array for which the memory size is measured.
Return values:
var memory size in bytes.
Example:
<item addr="524:248" name="Test for sizeof function" type="script"> V-ID/V-ADDR { if(opt0()) { u8 testU8; u16 testU16; u32 testU32; u8 testMasOfU8[4]; u16 testMasOfU16[4]; u32 testMasOfU32[4]; // Output the result to the interface u8 strForMess[200]; sprintf(strForMess, "%ctestU8 - %d\10testU16 - %d\10testU32 - %d\10testMasOfU8 - %d\10testMasOfU16 - %d\10testMasOfU32- %d", 1, sizeof(testU8), sizeof(testU16), sizeof(testU32), sizeof(testMasOfU8), sizeof(testMasOfU16), sizeof(testMasOfU32)); setStatus(@exciterId():32, &strForMess); } } </item>
The result of performing the example in the interface:
testU8 – 1
testU16 – 2
testU32 – 4
testMasOfU8 – 4
testMasOfU16 – 8
testMasOfU32 – 16