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

serial to parallel test with 74c595 and pic mcu

INTERRUPT_ON_CHANGE_18f4550