String constants, Mikroc – ABL electronic PIC Microcontrollers PIC16 User Manual

Page 52

Advertising
background image

String Constants

String constants, also known as string literals, are a special type of constants
which store fixed sequences of characters. A string literal is a sequence of any
number of characters surrounded by double quotes:

"This is a string."

The null string, or empty string, is written like

""

. A literal string is stored inter-

nally as the given sequence of characters plus a final null character. A null string is
stored as a single null character.

The characters inside the double quotes can include escape sequences, e.g.

"\t\"Name\"\\\tAddress\n\n"

Adjacent string literals separated only by whitespace are concatenated during the
parsing phase. For example:

"This is " "just"

" an example."

is an equivalent to

"This is just an example."

Line continuation with backslash

You can also use the backslash (

\

) as a continuation character to extend a string

constant across line boundaries:

"This is really \

a one-line string."

mikroC - C Compiler for Microchip PIC microcontrollers

mikroC

making it simple...

44

MikroElektronika: Development tools - Books - Compilers

page

Advertising
This manual is related to the following products: