User Tools

Site Tools


Sidebar

Programming Reference/Librarys

Question & Answer

Q&A is closed







c:string.h:strncat

strncat

#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 C Sourcecode Example

/* 
 * 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;
}

output of strncat c example

  the answer is: 42

on the occasion of the current invasion of Russia in Ukraine

Russian Stop this War
c/string.h/strncat.txt · Last modified: 2024/02/16 01:06 (external edit)

Impressum Datenschutz