# Introductory Formatting and Scanning Examples

Use the following examples to familiarize yourself with the formatting and scanning functions.

Convert the integer value 23 to its ASCII representation and place the contents in a string variable.

char a[5];
int b,n;
b = 23;
n = Fmt (a, "%s<%i", b);

After the Fmt call, a contains the string "23".

In this example, a is the target argument, b is the source argument, and "%s<%i" is the format string. Fmt uses the format string to determine how to convert the source argument into the target argument.

With Scan, you can convert the string "23" to an integer.

char *a;
a = "23";
n = Scan (a, "%s>%i", &b);

After the Scan call, b = 23.

In this example, a is the source argument, b is the target argument, and "%s>%i" is the format string. In both the formatting and the scanning functions, the format string defines the variable types of the source and target arguments. The format string also defines the method by which the source arguments are transformed into the target arguments.