Sie sind auf Seite 1von 2

C Program Copy One String to Another

using Pointers

#include<stdio.h>

void copystr(char*,char*);

void main()

char*str1="I am Dinesh Thakur";

char str2[30];

clrscr();

copystr(str2,str1);

printf("\n %s",str2);

getch();

void copystr(char *dest,char *src)

while(*src!='\0')

*dest++=*src++;

*dest='\0';
return;

Output :

I am Dinesh Thakur

Das könnte Ihnen auch gefallen