C strncat()-string concatenate up to n

<<Previous

Next >>





This function is used to concatenates the specified portion of one string at the end of another string

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

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

For example:

	strcat(str2, str1, 4) ----- first 4 characters of str1 is appended at the end of str2.

Following is an example program using strlen()

#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 = strncat(second,first,4);
  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 INDI

<< Previous

Next >>







C strncat()-string concatenate up to n

<<Previous

Next >>





This function is used to concatenates the specified portion of one string at the end of another string

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

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

For example:

	strcat(str2, str1, 4) ----- first 4 characters of str1 is appended at the end of str2.

Following is an example program using strlen()

#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 = strncat(second,first,4);
  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 INDI

<< 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