SW006013 Microchip Technology, SW006013 Datasheet - Page 108

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
DS51456E-page 104
ldiv (Continued)
malloc
Description:
Include:
Prototype:
Argument:
Return Value:
Remarks:
Example:
Output:
For ldiv(7, 3)
The quotient is 2 and the remainder is 1
For ldiv(7, -3)
The quotient is -2 and the remainder is 1
For ldiv(-5, 3)
The quotient is -1 and the remainder is -2
For ldiv(7, 7)
The quotient is 1 and the remainder is 0
For ldiv(7, 0)
The quotient is -1 and the remainder is 7
Explanation:
In the last example (ldiv(7,0)) the denominator is zero, the behavior
is undefined.
Allocates memory.
<stdlib.h>
void *malloc(size_t size);
size
Returns a pointer to the allocated space if successful; otherwise,
returns a null pointer.
malloc does not initialize memory it returns.
#include <stdio.h>
#include <stdlib.h> /* for malloc, free
int main(void)
{
}
Output:
Memory allocated
Memory freed
long *i;
if ((i = (long *)malloc(50 * sizeof(long))) ==
else
{
}
printf("Cannot allocate memory\n");
printf("Memory allocated\n");
free(i);
printf("Memory freed\n");
NULL)
number of characters to allocate
/* for printf, sizeof, */
/* NULL
© 2008 Microchip Technology Inc.
*/
*/

Related parts for SW006013