17.02.2015 Views

CCS C Compiler Manual PCB / PCM / PCH

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

copied into a temporary array of n characters that doesn't overlap the<br />

destination and source objects. Then the n characters from the temporary array<br />

are copied to destination.<br />

Availability:<br />

Requires:<br />

Examples:<br />

All devices<br />

Nothing<br />

memcpy(&structA, &structB, sizeof (structA));<br />

memcpy(arrayA,arrayB,sizeof (arrayA));<br />

memcpy(&structA, &databyte, 1);<br />

char a[20]="hello";<br />

memmove(a,a+2,5);<br />

// a is now "llo"<br />

Example Files:<br />

Also See:<br />

None<br />

strcpy(), memset()<br />

memset( )<br />

Syntax: memset (destination, value, n)<br />

Parameters:<br />

destination is a pointer to memory.<br />

value is a 8 bit int<br />

n is a 16 bit int.<br />

On <strong>PCB</strong> and <strong>PCM</strong> parts n can only be 1-255.<br />

Returns:<br />

Function:<br />

Availability:<br />

Requires:<br />

Examples:<br />

Example Files:<br />

undefined<br />

Sets n number of bytes, starting at destination, to value. Be aware that array<br />

names are pointers where other variable names and structure names are not<br />

(and therefore need a & before them).<br />

All devices<br />

Nothing<br />

memset(arrayA, 0, sizeof(arrayA));<br />

memset(arrayB, '?', sizeof(arrayB));<br />

memset(&structA, 0xFF, sizeof(structA));<br />

None<br />

222

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!