summary refs log tree commit diff
path: root/manual/examples/strncat.c
blob: f865167f4affde1d543c7fd9c6afa50aae33c659 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
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);
}