User Tools

Site Tools


Sidebar

Programming Reference/Librarys

Question & Answer

Q&A is closed







c:string.h:strcat

strcat

#include <stdlib.h>
char *strcat(char *str1, const char *str2);

description of strcat

The strcat function concatenates two strings.
str1 = target string to be added to source
str2 = source string to copied, including '\ 0' at the end of destination.
null byte of destination will be overwritten.

strcat C Sourcecode Example

/* 
 * strcat example code
 * http://code-reference.com/c/string.h/strcat
 */
#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 strcat c example

  user@host:~$ ./strcat 
  strcpy c example 
  strcpy c example for c 

on the occasion of the current invasion of Russia in Ukraine

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

Impressum Datenschutz