Thursday, January 7, 2010

PROGRAM TO COPY ONE STRING TO ANOTHER USING POINTERS

//WAP TO COPY ONE STRING TO ANOTHER USING POINTERS
#include
#include
void copystr(char*,char*);
main()
{
char *str1="YOU ARE COPYING";
char str2[20];
clrscr();
copystr(str2,str1);

printf("\n%s",str2);
getch();
}
void copystr(char *dest,char *src)
{
while(*src!='\0')
{
*dest++=*src++;
}
*dest='\0';
return;
}

/*******************************************************************
OUTPUT
*******************************************************************

YOU ARE COPYING
*/

5 comments:

  1. This comment has been removed by a blog administrator.

    ReplyDelete
  2. This comment has been removed by a blog administrator.

    ReplyDelete
  3. This comment has been removed by a blog administrator.

    ReplyDelete
  4. This comment has been removed by a blog administrator.

    ReplyDelete
  5. This comment has been removed by the author.

    ReplyDelete

Programming the Whole World!