NXC  Version 1.2.1 r5
 All Data Structures Files Functions Variables Groups Pages
ex_reladdressof.nxc

This is an example of how to use the reladdressOf function.

task main()
{
char x[]={1, 2, 3, 4, 5, 6, 7, 8, 9, 0};
unsigned long ptr = reladdressOf(x);
TextOut(0, LCD_LINE1, FormatNum("%x", ptr));
args.Count = 10;
NumOut( 0, LCD_LINE2, x[0]);
NumOut(20, LCD_LINE2, x[1]);
NumOut(40, LCD_LINE2, x[2]);
NumOut(60, LCD_LINE2, x[3]);
NumOut(80, LCD_LINE2, x[4]);
NumOut( 0, LCD_LINE3, args.Buffer[0]);
NumOut(20, LCD_LINE3, args.Buffer[1]);
NumOut(40, LCD_LINE3, args.Buffer[2]);
NumOut(60, LCD_LINE3, args.Buffer[3]);
NumOut(80, LCD_LINE3, args.Buffer[4]);
args.Buffer++;
args.Buffer *= 3;
a2.Buffer = args.Buffer;
NumOut( 0, LCD_LINE4, x[0]);
NumOut(20, LCD_LINE4, x[1]);
NumOut(40, LCD_LINE4, x[2]);
NumOut(60, LCD_LINE4, x[3]);
NumOut(80, LCD_LINE4, x[4]);
}