4 /* print contents of array */
5 void print_array(char s
[])
8 for(i
= 0; i
< strlen(s
); i
++)
15 Copy at most n chars of string source into string dest.
16 Pad with '\0' if source has fewer chars than dest.
19 char *ss_strncpy(char *dest
, const char *source
, int n
)
22 if(n
>= 0 || n
== '\0')
24 while(--n
>= 0 && (*dest
++ = *source
++) != '\0')
35 char source
[] = { "Destination after..." };
36 char dest
[] = { "This is the destination before..." };
42 ans
= strncpy(dest
, source
, 20);
49 char source2
[] = { "Destination after..." };
50 char dest2
[] = { "This is the destination before..." };
54 ss_strncpy(dest2
, source2
, 20);