Display of char type arrays

Parent Previous Next

Debug Options window


Arrays of type char can be displayed in watch window as zero terminated strings.

If the option is not checked, the string is displayed as a array of 8-bit characters. Individual elements are displayed according to Character display configuration in the same dialog.

Location: Debug/Options/Symbols

Default: ON


Expression override modifiers

The above global setting can be explicitly overridden for individual watches with watch modifiers.

To force string interpretation, use the ,s modifier.
From context menu select: char[]

To force array interpretation, use the ,a modifier.
From context menu select: Display char[] as string


Example:

char sz[] = “Hello World”;

Char sz [] example


Array offset and number of elements displayed

To allow viewing elements of large arrays, watch modifiers can be used to set the first displayed element and number of displayed elements.


Format:

<watch expression>,a[<first element][.<number of elements>]


Example:

sz,a3        // display array elements starting from sz[3]

sz,a3.2        // display 2 array elements, starting at sz[3]

sz,a.2        // display first 2 array elements


This modifier can also be set by selecting 'Set array offset'...' from the Format command in context menu.

Set array offset window



Set array example