about summary refs log tree commit diff
path: root/manual/examples/strncat.c
blob: 948d662a4e2281588ef19bb31e17df696ec07fd5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include <string.h>
#include <stdio.h>

#define SIZE 10

static char buffer[SIZE];

int
main (void)
{
  strncpy (buffer, "hello", SIZE);
  puts (buffer);
  strncat (buffer, ", world", SIZE - strlen (buffer) - 1);
  puts (buffer);
}