beautypg.com

String handling

Page 433

background image

UM017105-0511

Standard Header Files

Zilog Developer Studio II – ZNEO™

User Manual

405

Integer Arithmetic

String Handling

The <

string.h

> header declares several functions useful for manipulating character

arrays and other objects treated as character arrays. Various methods are used for deter-
mining the lengths of arrays, but in all cases a char* or void* argument points to the initial
(lowest addressed) character of the array. If an array is written beyond the end of an object,
the behavior is undefined.

Type

Macro

Functions

Copying

int abs(int j);

Finds absolute value of integer value.

div_t div(int numer, int denom);

Computes integer quotient and remainder.

long int labs(long int j);

Finds absolute value of long integer value.

ldiv_t ldiv(long int numer, long int denom);

Computes long quotient and remainder.

size_t

Unsigned integral type of the result of the sizeof operator.

NULL

Expands to a null pointer constant.

void *memcpy(void *s1, const void *s2, size_t n);

Copies a specified number of char-
acters from one buffer to another.

void *memmove(void *s1, const void *s2, size_t n); Moves a specified number of charac-

ters from one buffer to another.

char *strcpy(char *s1, const char *s2);

Copies one string to another.

char *strncpy(char *s1, const char *s2, size_t n);

Copies n characters of one string to
another.

This manual is related to the following products: