ANSI C Stdlib Library

The mikroPascal PRO for PIC provides a set of standard ANSI library functions of general utility.

  Important :

Library Dependency Tree

C Stdlib Library Dependency Tree

Library Functions

abs

Prototype

function abs(a : integer) : integer;

Description

Function returns the absolute (i.e. positive) value of a.

Example
res := abs(-12);  // res = 12

labs

Prototype

function labs(x : longint) : longint;

Description

Function returns the absolute (i.e. positive) value of long integer x.

Example
res := labs(-2147483647);  // res = 12

min

Prototype

function min(a, b : integer) : integer;

Description

Function returns lower of the two integers, a and b.

Example
res := min(123,67);  // function returns 67

max

Prototype

function max(a, b : integer) : integer;

Description

Function returns greater of the two integers, a and b.

Example
res := max(123,67);  // function returns 123

rand

Prototype

function rand() : integer;

Description

Function returns a sequence of pseudo-random numbers between 0 and 32767. The function will always produce the same sequence of numbers unless srand is called to seed the start point.

Example
while TRUE do
  res := rand();
end;

srand

Prototype

procedure srand(x : word);

Description

Function uses x as a starting point for a new sequence of pseudo-random numbers to be returned by subsequent calls to rand. No values are returned by this function.

Example
srand(9);
Copyright (c) 2002-2012 mikroElektronika. All rights reserved.
What do you think about this topic ? Send us feedback!
Want more examples and libraries? 
Find them on LibStock - A place for the code