Chapter Contents |
Previous |
Next |
Command Directory |
Print the Value of an Expression
p{rint}
Format 1: |
print |
|
Format 2: |
print |
EXPRESSION |
Format 3: |
print |
EXPRESSION [%FMT] [COUNT] [,EXPRESSION [%FMT ] [COUNT] ] |
print
command prints the value of various program elements. The specific elements
printed depend on the format of the print
command
that you use.
Format 1: With Format 1, what is printed
depends on where execution is interrupted when you issue print
, as shown in
Output from the print Command with No Arguments.
Format
2: This format of the print
command displays the value of the expression identifier.
The value is displayed according to its type, as declared in the source
code. If the EXPRESSION contains a modulus (
%
) operator, see Format 3.
When you issue Format 2 of the print
command, the value of EXPRESSION is printed according to
its type shown in Output Format for Values of Expressions Using the print Command.
The %FMT argument can be any of the format specifiers
that you use with the
sprintf
function. These are
c
|
single character |
d
|
decimal signed integer |
e
|
or
E
exponential floating
point |
f
|
fixed decimal floating point |
g
|
or
G
f format or e format |
o
|
octal integer |
s
|
character string |
u
|
decimal unsigned integer |
x
|
hexadecimal integer (lowercase) |
X
|
hexadecimal integer (uppercase) |
The print
command supports
any
%
format specification that results in the item being
formatted in 256 or fewer bytes. If the %FMT argument is not specified, the
debugger uses a format determined by the type of the expression (as in Format
2).
print
command examples are based on the following declarations:
int i; double d; struct XYZ {int a; double b; } xyz; struct INT2 {int a,b;} int2; struct XYZ * pxyz; int arr[10] ;
print i
i
.
print i, d
i
and
d
.
print i + d
i
plus
d
.
print xyz.a
xyz.a
.
print pxyz -->
b
pxyz
-->
b
.
print arr[i]
arr
array.
print *(arr+i) + int2.a
arr
plus the value of member
a
in struct
int2
.
print *arr 5
arr
.
print ::xyz
print
command uses command scope to resolve references to all identifiers.
Successful: 0 | |
Unsuccessful: 1 |
Chapter Contents |
Previous |
Next |
Top of Page |
Copyright © 2001 by SAS Institute Inc., Cary, NC, USA. All rights reserved.