SW006014 Microchip Technology, SW006014 Datasheet - Page 123

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.
memset
Description:
Include:
Prototype:
Arguments:
Return Value:
Remarks:
Example:
Copies the specified character into the destination buffer.
<string.h>
void *memset(void *s, int c, size_t n);
s
c
n
Returns the buffer with characters written to it.
The character c is written to the buffer n times.
#include <string.h> /* for memset */
#include <stdio.h>
int main(void)
{
}
Output:
memset("What time is it?", '?',4);
buf1 after memset: ???? time is it?
memset("", 'y',10);
buf2 after memset: yyyyyyyyyy
char buf1[20] = "What time is it?";
char buf2[20] = "";
char ch1 = '?', ch2 = 'y';
char *ptr;
int res;
printf("memset(\"%s\", \'%c\',4);\n", buf1, ch1);
memset(buf1, ch1, 4);
printf("buf1 after memset: %s\n", buf1);
printf("\n");
printf("memset(\"%s\", \'%c\',10);\n", buf2, ch2);
memset(buf2, ch2, 10);
printf("buf2 after memset: %s\n", buf2);
buffer
character to put in buffer
number of times
/* for printf */
DS51456E-page 119

Related parts for SW006014