void *memcpy( void *target, const void *source, size_t bytes )
Copies a block of memory from one pointer to another. It's like
strchr
, but it's memory blocks, not a string.
int *new_scores = malloc( 100 * sizeof( int ) ); memcpy( new_scores, original_scores, 100 * sizeof(int) );
void *memcpy( void *target, const void *source, size_t bytes ) { char *p = target; while ( bytes-- ) { *p++ = *source++; } return target; }TOC | Prev | Next