Encoders
Hub for Computer Whizzes Register to join us

Encoders > More... > C > Program

/* Function strcpy(s,t) to copy the string t into s and return the copied
   string. (using pointers) */

#include <stdio.h>

char *strcpy(char *s, char *t);

main()
{
	char a[100];
        printf("%s\n",strcpy(a,"hello world"));
}

char *strcpy(char *s, char *t)
{
	char *start = s;
	while(*s++ = *t++)
		;
	return start;
}