/*
 * 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 ) );
}

  

相关文章:

  • 2021-09-21
  • 2022-01-11
  • 2021-10-12
  • 2022-02-18
  • 2021-10-13
  • 2021-07-14
  • 2021-08-04
猜你喜欢
  • 2022-01-04
  • 2021-09-29
  • 2022-02-27
  • 2022-12-23
  • 2021-06-03
相关资源
相似解决方案