12345678910111213141516171819202122232425
#include <stdio.h> #include <string.h> int main() { char s1[] = "aeiou"; char s2[11] = "0123456789"; char s3[5]; printf("output 01 -------------\n"); printf("%s\n", s1); printf("%s\n", s2); printf("%s\n", s3); printf("-----------------------\n"); strcpy(s1, s2); printf("output 02 -------------\n"); printf("%s\n", s1); printf("%s\n", s2); printf("%s\n", s3); printf("-----------------------\n"); return 0; }
1234567891011
output
output 01 ------------- aeiou 0123456789 ����0123456789 ----------------------- output 02 ------------- 0123456789 0123456789 ����0123456789 ----------------------- Segmentation fault