Programming Reference/Librarys
Question & Answer
Q&A is closed
#include <stdlib.h> char *strncat(char *dest, const char *src, size_t n);
appends the src
string to the dest
string, overwriting
the null byte ('\0') at the end of dest
, and then adds a terminating null
byte. The strings may not overlap, and the dest
string must have enough space for the result.
/* * strncat example code * http://code-reference.com/c/string.h/strncat */ #include <stdio.h> #include <string.h> int main ( void ) { char str[42]="strcpy "; strcat (str,"c example "); printf("%s\n", str); strcat(str, "for c"); printf("%s\n", str); return 0; }
the answer is: 42