SW006014 Microchip Technology, SW006014 Datasheet - Page 99

C COMPILER MPLAB FOR PIC24 MCU

SW006014

Manufacturer Part Number
SW006014
Description
C COMPILER MPLAB FOR PIC24 MCU
Manufacturer
Microchip Technology
Type
MPLAB® C Compilerr
Series
PIC24r
Datasheet

Specifications of SW006014

Supported Families
PIC24
Core Architecture
PIC
Kit Contents
Software And Docs
Mcu Supported Families
PIC24
Tool Function
Compiler
Tool Type
Compiler
Processor Series
PIC24
Lead Free Status / RoHS Status
Not applicable / Not applicable
For Use With/related Products
PIC24
Lead Free Status / Rohs Status
Lead free / RoHS Compliant
© 2008 Microchip Technology Inc.
atoi
Description:
Include:
Prototype:
Argument:
Return Value:
Remarks:
Example:
atol
Description:
Include:
Prototype:
Argument:
Return Value:
Remarks:
Converts a string to an integer.
<stdlib.h>
int atoi(const char *s);
s
Returns the converted integer if successful; otherwise, returns 0.
The number may consist of the following:
optional whitespace, followed by an optional sign then a sequence
of one or more digits. The conversion stops when the first unrecog-
nized character is reached. The conversion is equivalent to (int)
strtol(s,0,10) except it does no error checking so errno will not
be set.
#include <stdio.h>
#include <stdlib.h> /* for atoi
int main(void)
{
}
Output:
String = " -127"
String = "Number1"
Converts a string to a long integer.
<stdlib.h>
long atol(const char *s);
s
Returns the converted long integer if successful; otherwise, returns 0
The number may consist of the following:
optional whitespace, followed by an optional sign then a sequence
of one or more digits. The conversion stops when the first unrecog-
nized character is reached. The conversion is equivalent to (int)
strtol(s,0,10) except it does no error checking so errno will not
be set.
[whitespace] [sign] digits
char a[] = " -127";
char b[] = "Number1";
int x;
x = atoi(a);
printf("String = \"%s\"\tint = %d\n", a, x);
x = atoi(b);
printf("String = \"%s\"\tint = %d\n", b, x);
[whitespace] [sign] digits
string to be converted
string to be converted
/* for printf */
int = -127
int = 0
*/
DS51456E-page 95

Related parts for SW006014