ANSI C Stdlib Library

The mikroBasic PRO for dsPIC30/33 and PIC24 provides a set of standard ANSI library functions of general utility.

  Important :

Library Dependency Tree

C Stdlib Library Dependency Tree

Library Functions

abs

Prototype

sub function abs(dim a as integer) as integer

Description

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

Example
res = abs(-12)  ' res = 12

labs

Prototype

dim function labs(dim x as longint) as longint

Description

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

Example
res = labs(-2147483647)  ' res = 12

min

Prototype

sub function min(dim a, b as integer) as integer

Description

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

Example
res = min(123,67)  ' function returns 67

max

Prototype

sub function max(dim a, b as integer) as integer

Description

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

Example
res = max(123,67)  ' function returns 123

rand

Prototype

sub function rand() as 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
  res = rand()
wend

srand

Prototype

sub procedure srand(dim x as 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