The sizeof operator yeilds the number of bytes required to store an object of the type of its operand. Note that 16 and 32bit compilers may add padd bytes and these will be included in the sizeof – this can be a source of bugs! Getting array length from sizeof Avoiding Padding You can used […]
All posts by
Pointer To A Function
The function: WORD my_function_name (BYTE a, WORD b); Declaring a pointer to a function: WORD (*p_function)(BYTE a, WORD b); Loading it: p_function = &my_function_name; Calling it: btemp = my_function_name(1, 2); or btemp = (*my_function_name)(1, 2); If your function returns a pointer of some sort then thts fine, just add the extra asterix: WORD *my_function_name (BYTE […]
Memory Pointers
Write to a specific location in memory Using pointers with an array index Calling Function That Wants A Constant Pointer With A Variable Pointer
Using Loops
Loop control Exit Loop Jump Back To Start Of Loop (to the loop test condition) For Loop For Each Loops While Loops
Defines
General Define Usage Create a define Use a define Define if not already defined Define using another define Multi Line Continuation Character Use the ‘\’ backslash character at the end of each line except for the last.If you have any comments surround them with /* */ (don’t use // ) Can you use string in […]
Line Continuation Character
\ //Put a ‘\’ at the end of a line to signify to compiler next line shoud be part of this line //This is useful for defines etc, e.g.:- #define USBInitialize(x) \ { \ USBHostInit(x); \ }