beautypg.com

Sprintf, Sqrt, Sprintf sqrt – Zilog EZ80F916 User Manual

Page 383

background image

UM014423-0607

C Standard Library

ZiLOG Developer Studio II

eZ80Acclaim!

®

User Manual

363

Example

double x=1.24;
double y;
y=sinh(x);

sprintf

The

sprintf

function is equivalent to

printf

, except that the argument s specifies an

array into which the generated output is to be written, rather than to a stream. A null char-
acter is written at the end of the characters written; it is not counted as part of the returned
sum.

Synopsis

#include
int sprintf(char *s, char *format, ...);

Returns

The number of characters written in the array, not counting the terminating null character.

Example

int d=51;
char buf [40];
sprintf(buf,"COMPASS/%d",d);

sqrt

Computes the non-negative square root of x. A domain error occurs if the argument is neg-
ative.

Synopsis

#include
double sqrt(double x);

Returns

The value of the square root.

Example

double x=25.0;
double y;
y=sqrt(x);

This manual is related to the following products: