String Functions - Casio FX-890P Owner's Manual

Casio personal computer owner's manual
Table of Contents

Advertisement

6.3.2 String Functions

The string functions are part of a standard library in ANSI C, and it is recommended
to add the following comment at the beginning of your program:
/* #include <string.h> */
strcat()
PURPOSE: Appends a source string after the destination string.
FORMAT:
char *strcat(dest, source) char *dest, *source;
PARAMETERS:
1. Destination string.
2. Source string.
EXPLANATION:
1. The source string stays untouched.
2. The destination string is modified by concatenation of the source string after it.
Note that no control is made on the memory available for the resulting string.
Using strcat() without enough memory booked for the result string may result
in an overflow.
3. The returned value is the destination string, and is therefore equal to the first
parameter.
strchr()
PURPOSE: Searches for a character in a string.
FORMAT:
char *strchr(string, c) char *string; int c;
PARAMETERS:
1. string.
2. c is a character.
EXPLANATION:
1. The string stays untouched.
2. The returned value is a pointer to the first position of the character c in the
string.
3. If the character cannot be found, the function returns the NULL pointer.
strcmp()
PURPOSE: Compares two strings.
FORMAT:
int strcmp(string1, string2) char *string1, *string2;
PARAMETERS: 2 strings
EXPLANATION:
1. The parameter strings stays untouched.
2. Returned value is zero when the two strings are identical
3. Retuned value is negative when the first differing character of string1 is
smaller than its counterpart character in string2.
4. Retuned value is positive when the first differing character of string1 is bigger
than its counterpart character in string2.
123

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Z-1grZ-1

Table of Contents