beautypg.com

Scanf, Synopsis, Returns – Zilog ZUSBOPTS User Manual

Page 464: Example

background image

Standard Functions

UM017105-0511

436

Zilog Developer Studio II – ZNEO™
User Manual

zero, the

realloc

function returns a null pointer and, if ptr is not a null pointer, the object

it points to is freed.

Synopsis

#include

void *realloc(void *ptr, size_t size);

Returns

Returns a pointer to the start (lowest byte address) of the possibly moved object.

Example

char *buf;

buf=(char *) malloc(40*sizeof(char));

buf=(char *) realloc(buf, 80*sizeof(char));

if(buf !=NULL)

/*success*/

else

/*fail*/

scanf

Reads input from the stream pointed to by stdin, under control of the string pointed to by
format that specifies the admissible input sequences and how they are to be converted for
assignment, using subsequent arguments as pointers to the object to receive the converted
input. If there are insufficient arguments for the format, the behavior is undefined. If the
format is exhausted while arguments remain, the excess arguments are evaluated but oth-
erwise ignored.

The format is composed of zero or more directives from the following list:

one or more white-space characters

an ordinary character (not

%

)

a conversion specification

Each conversion specification is introduced by the “

%

” character. After this % character,

the following items appear in sequence:

1. An optional assignment-suppressing character (

*

).

2. An optional decimal integer that specifies the maximum field width.

3. An optional h, l or L indicating the size of the receiving object. The conversion char-

acters d, l, n, o, and x can be preceded by h to indicate that the corresponding argu-
ment is a pointer to

short_int

rather than a pointer to int, or by l to indicate that it is

This manual is related to the following products: