Copy character pointer type string to character array

//copy character pointer to character array


#include<iostream.h>

using namespace std;

int main(int argc, char *argv[])

{

void copy(char*, char*);

char* st="Hello world";

char st1[100];

copy(st1,st);

cout<<st1;

return 0;

}

void copy(char* s1, char* s2)

{

while(*s2)

*s1++=*s2++;

*s1='\0';

}



Comments

Popular posts from this blog

ဆိုလာ စနစ္ရွိ BATTERY AMPACITY အား design ထုတ္တြက္ခ်က္ၿခင္း (1) watt hour ရယူၿခင္း

Pointer to object array