SW006013 Microchip Technology, SW006013 Datasheet - Page 111

MPLAB C Compiler For DsPIC DSCs

SW006013

Manufacturer Part Number
SW006013
Description
MPLAB C Compiler For DsPIC DSCs
Manufacturer
Microchip Technology
Series
DsPIC30F/33Fr
Type
MPLAB® C Compilerr
Datasheet

Specifications of SW006013

Supported Families
DsPIC30F, DsPIC33F
Core Architecture
DsPIC
Kit Contents
Software And Docs
Mcu Supported Families
DsPIC30F And DsPIC33F
Tool Function
Compiler
Tool Type
Compiler
Processor Series
dsPIC
Lead Free Status / RoHS Status
na
For Use With/related Products
dSPIC DSCs
Lead Free Status / Rohs Status
Lead free / RoHS Compliant
© 2008 Microchip Technology Inc.
rand
Description:
Include:
Prototype:
Return Value:
Remarks:
Example:
realloc
Description:
Include:
Prototype:
Arguments:
Return Value:
Remarks:
Generates a pseudo-random integer.
<stdlib.h>
int rand(void);
Returns an integer between 0 and RAND_MAX.
Calls to this function return pseudo-random integer values in the range
[0,RAND_MAX]. To use this function effectively, you must seed the ran-
dom number generator using the srand function. This function will
always return the same sequence of integers when no seeds are used
(as in the example below) or when identical seed values are used. (See
srand for seed example.)
#include <stdio.h>
#include <stdlib.h> /* for rand
int main(void)
{
}
Output:
Number = 21422
Number = 2061
Number = 16443
Number = 11617
Number = 9125
Notice if the program is run a second time, the numbers are the same.
See the example for srand to seed the random number generator.
Reallocates memory to allow a size change.
<stdlib.h>
void *realloc(void *ptr, size_t size);
ptr
size
Returns a pointer to the allocated space if successful; otherwise,
returns a null pointer.
If the existing object is smaller than the new object, the entire existing
object is copied to the new object and the remainder of the new object
is indeterminate. If the existing object is larger than the new object, the
function copies as much of the existing object as will fit in the new
object. If realloc succeeds in allocating a new object, the existing
object will be deallocated; otherwise, the existing object is left
unchanged. Keep a temporary pointer to the existing object since
realloc will return a null pointer on failure.
int x;
for (x = 0; x < 5; x++)
printf("Number = %d\n", rand());
points to previously allocated memory
new size to allocate to
/* for printf */
*/
DS51456E-page 107

Related parts for SW006013