Initial bulk commit for "Git on MSys"
[msysgit/historical-msysgit.git] / mingw / info / gdb / C-Constants.html
blob5e0adf67bbb53dabd01407aabd3d0b16b81a4543
1 <html lang="en">
2 <head>
3 <title>Debugging with GDB</title>
4 <meta http-equiv="Content-Type" content="text/html">
5 <meta name="description" content="Debugging with GDB">
6 <meta name="generator" content="makeinfo 4.3">
7 <link href="http://www.gnu.org/software/texinfo/" rel="generator-home">
8 </head>
9 <body>
10 <div class="node">
11 <p>
12 Node:<a name="C%20Constants">C Constants</a>,
13 Next:<a rel="next" accesskey="n" href="C-plus-plus-expressions.html#C%20plus%20plus%20expressions">C plus plus expressions</a>,
14 Previous:<a rel="previous" accesskey="p" href="C-Operators.html#C%20Operators">C Operators</a>,
15 Up:<a rel="up" accesskey="u" href="C.html#C">C</a>
16 <hr><br>
17 </div>
19 <h5 class="subsubsection">C and C<tt>++</tt> constants</h5>
21 GDB allows you to express the constants of C and C<tt>++</tt> in the
22 following ways:
24 <ul>
25 <li>Integer constants are a sequence of digits. Octal constants are
26 specified by a leading <code>0</code> (i.e. zero), and hexadecimal constants
27 by a leading <code>0x</code> or <code>0X</code>. Constants may also end with a letter
28 <code>l</code>, specifying that the constant should be treated as a
29 <code>long</code> value.
31 <li>Floating point constants are a sequence of digits, followed by a decimal
32 point, followed by a sequence of digits, and optionally followed by an
33 exponent. An exponent is of the form:
34 <code>e</code>[[<code>+</code>]|<code>-</code>]<code></code><var>nnn</var><code></code>, where <var>nnn</var> is another
35 sequence of digits. The <code>+</code> is optional for positive exponents.
36 A floating-point constant may also end with a letter <code>f</code> or
37 <code>F</code>, specifying that the constant should be treated as being of
38 the <code>float</code> (as opposed to the default <code>double</code>) type; or with
39 a letter <code>l</code> or <code>L</code>, which specifies a <code>long double</code>
40 constant.
42 <li>Enumerated constants consist of enumerated identifiers, or their
43 integral equivalents.
45 <li>Character constants are a single character surrounded by single quotes
46 (<code>'</code>), or a number--the ordinal value of the corresponding character
47 (usually its <small>ASCII</small> value). Within quotes, the single character may
48 be represented by a letter or by <dfn>escape sequences</dfn>, which are of
49 the form <code>\</code><var>nnn</var><code></code>, where <var>nnn</var> is the octal representation
50 of the character's ordinal value; or of the form <code>\</code><var>x</var><code></code>, where
51 <code></code><var>x</var><code></code> is a predefined special character--for example,
52 <code>\n</code> for newline.
54 <li>String constants are a sequence of character constants surrounded by
55 double quotes (<code>"</code>). Any valid character constant (as described
56 above) may appear. Double quotes within the string must be preceded by
57 a backslash, so for instance <code>"a\"b'c"</code> is a string of five
58 characters.
60 <li>Pointer constants are an integral value. You can also write pointers
61 to constants using the C operator <code>&amp;</code>.
63 <li>Array constants are comma-separated lists surrounded by braces <code>{</code>
64 and <code>}</code>; for example, <code>{1,2,3}</code> is a three-element array of
65 integers, <code>{{1,2}, {3,4}, {5,6}}</code> is a three-by-two array,
66 and <code>{&amp;"hi", &amp;"there", &amp;"fred"}</code> is a three-element array of pointers.
67 </ul>
69 <ul class="menu">
70 <li><a accesskey="1" href="C-plus-plus-expressions.html#C%20plus%20plus%20expressions">C plus plus expressions</a>:
71 <li><a accesskey="2" href="C-Defaults.html#C%20Defaults">C Defaults</a>:
72 <li><a accesskey="3" href="C-Checks.html#C%20Checks">C Checks</a>:
74 <p>
75 </p><li><a accesskey="4" href="Debugging-C.html#Debugging%20C">Debugging C</a>:
76 </ul>
78 </body></html>