User Tools

Site Tools


c:string.h:strncat

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

c:string.h:strncat [2012/07/16 22:41]
127.0.0.1 external edit
c:string.h:strncat [2024/02/16 01:06] (current)
Line 1: Line 1:
-    char *strncat(char *str1, const char *str2, size_t n);+====== strncat ====== 
 + 
 +<code c> 
 +#include <stdlib.h> 
 +    char *strncat(char *dest, const char *src, size_t n); 
 +</code> 
 +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 ===== 
 +<code c> 
 +/*  
 + * 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; 
 +
 +</code> 
 + 
 +==== 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.1342471298.txt · Last modified: 2024/02/16 01:03 (external edit)

Impressum Datenschutz