C strcat() - string concatenate

<<Previous

Next >>





This function is used to add two strings. Usually, it appends one string at the end of another string.

Syntax:
	char *strcat ( char *dest, const char *src );

The above statement shows that the source string is appended at the end of destination string.

Following is an example program using strcat()

#include<stdio.h>

#include<string.h>


main()
{
  char first[] = "INDIA";
  char second[] = "WELCOME";
  char result;

  printf(" The first string is %s ",first);
  printf(" \n The second string is %s ",second);

  result = strcat(second,first);
  printf(" \n The concatenate of two strings are %s = ",result);
  return(0);
}

Output:

The first string is INDIA
The second string is WELCOME
The concatenate of two strings are WELCOME INDIA

<< Previous

Next >>







C strcat() - string concatenate

<<Previous

Next >>





This function is used to add two strings. Usually, it appends one string at the end of another string.

Syntax:
	char *strcat ( char *dest, const char *src );

The above statement shows that the source string is appended at the end of destination string.

Following is an example program using strcat()

#include<stdio.h>

#include<string.h>


main()
{
  char first[] = "INDIA";
  char second[] = "WELCOME";
  char result;

  printf(" The first string is %s ",first);
  printf(" \n The second string is %s ",second);

  result = strcat(second,first);
  printf(" \n The concatenate of two strings are %s = ",result);
  return(0);
}

Output:

The first string is INDIA
The second string is WELCOME
The concatenate of two strings are WELCOME INDIA

<< Previous

Next >>







Learn about Hashing and Hash table

Learn Expression Tree

OS Kernel Architecture

OS Arcitecture of Windows, Linux and MacOS

Learn OS scheduling Algorithms