/*
* author:lx
* date: 2011-10-04
* brief: strcpy
*/
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
void*
lx_strcpy( char *p, char *q )
{
char *address = q;
for ( ; *p != '\0'; p++ )
{
assert( *q != '\0' );
*q = *p;
q++;
}
return address;
}
int
main( void )
{
char p[20] = "hello world";
char d[50] = "what why how and which where!";
printf ( "%s\n", (char*)lx_strcpy( p, d ) );
}