diff options
Diffstat (limited to 'manual/examples/strncat.c')
-rw-r--r-- | manual/examples/strncat.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/manual/examples/strncat.c b/manual/examples/strncat.c new file mode 100644 index 0000000000..f865167f4a --- /dev/null +++ b/manual/examples/strncat.c @@ -0,0 +1,14 @@ +#include <string.h> +#include <stdio.h> + +#define SIZE 10 + +static char buffer[SIZE]; + +main () +{ + strncpy (buffer, "hello", SIZE); + puts (buffer); + strncat (buffer, ", world", SIZE - strlen (buffer) - 1); + puts (buffer); +} |