#include <stdio.h>
#define STRNCPY(DST, ORG, N) { \
char *s1 = (DST); \
const char *s2 = (ORG); \
size_t n = (N); \
int i; \
for (i = 0; i < n && s2[i] != 0; i++) \
{ \
s1[i] = s2[i]; \
} \
s1[i] = 0; }
int main (void)
{
char stringa[100];
STRNCPY (stringa, "Buon giorno a tutti!", 50) // [1]
// [1] Si osservi che manca il
// punto e virgola finale!
printf ("%s\n", stringa);
return 0;
}