String Copy in C
Level 3112 keystrokes
Uses strcpy to copy a string from source to destination array.
C code
// Source string: 5 letters plus '\0'1char src[] = "Hello";// The destination must be large enough; strcpy does not check the size2char dest[20];// Copy src into dest, including the '\0' (destination comes first)3strcpy(dest, src);// The source is unchanged4printf("Source: %s\n", src);// dest now holds its own copy: Hello5printf("Dest: %s\n", dest);Output
Source: Hello Dest: Hello
Practice typing this code. Results are not recorded in the rankings.
Symbols in this code
The symbols you type in this C code and how often they appear.
"× 6;× 5,× 3(× 3)× 3:× 2[× 2]× 2\× 2%× 2