C - strcpy() - string copy

<<Previous

Next >>





This function copies the entire content from one string to another string.

Syntax:
	char *strcpy(char *dest, const char *src)

For example:

	strcpy(s2,s1)-->copies content from s1 into s2.

Following is an example program using strcpy()

#include<stdio.h>

#include<string.h>


main()
{
  char source[]={’W’,‘E’,‘L’,‘C’, ‘O’,‘M’,‘E’};
  char dest[10]=" ";

  printf("The source string is %s",source);
  strcpy(dest,source);
  printf("The destination string after copy %s",dest);
  return(0);
}

Output:

The source string is WELCOME
The destination string after copy WELCOME

<< Previous

Next >>







C - strcpy() - string copy

<<Previous

Next >>





This function copies the entire content from one string to another string.

Syntax:
	char *strcpy(char *dest, const char *src)

For example:

	strcpy(s2,s1)-->copies content from s1 into s2.

Following is an example program using strcpy()

#include<stdio.h>

#include<string.h>


main()
{
  char source[]={’W’,‘E’,‘L’,‘C’, ‘O’,‘M’,‘E’};
  char dest[10]=" ";

  printf("The source string is %s",source);
  strcpy(dest,source);
  printf("The destination string after copy %s",dest);
  return(0);
}

Output:

The source string is WELCOME
The destination string after copy WELCOME

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