Files
RedBear-OS/tests/string/strcpy.c
T
2019-02-20 19:27:18 +01:00

18 lines
329 B
C

#include <stdio.h>
#include <string.h>
int main(void) {
char dst[20];
strcpy(dst, "strcpy works!");
puts(dst);
strncpy(dst, "strncpy works!", 20);
puts(dst);
// Make sure no NUL is placed
memset(dst, 'a', 20);
dst[19] = 0;
strncpy(dst, "strncpy should work here too", 10);
puts(dst);
}