Monday 6 January 2014

C PROGRAM TO DEVELOP STRING FUNCTION -- strcpy

#include<stdio.h>
#include<string.h>
#include<conio.h>

void  my_strcpy(char *dest , char *source);


int main()
{
    char str[20];
    char dest[20];
    printf("enter any string:");
    scanf("%s",str);
   
    my_strcpy(dest,str);
   
    printf("\ndest=%s",dest);
   
    getch();
    return 0;
}



void my_strcpy(char *dest,char *source)
{
     while(*source!='\0')
     {
                         *dest++=*source++;
                         }
                         *dest='\0';
                        
                         }

No comments:

Post a Comment