1 2 3 4 5 6 7 8 9 10 11 12 13
#include <stdio.h> #include <stdlib.h> int main() { char s1[] = "1234567890"; char s2[] = "12345"; char *p = new char[15]; strcpy(p, s1); printf("%s\n", p); strcpy(p, s2); printf("%s\n", p); printf("%s\n", p+6); }
1 2 3
1234567890 12345 7890