C - String Manipulation Functions, strcpy
Tutorials Point


  Learning C
  C Function References
  C Useful Resources
  Selected Reading

Copyright © 2014 by tutorialspoint



  Home     References     About TP     Advertising  

C - strcpy function

previous

Synopsis:

#include <stdio.h>

char *strcpy (char *dest, char *src); 

Description:

The strcpy function copies characters from src to dest up to and including the terminating null character.

Return Value

The strcpy function returns dest.

Example

#include <stdio.h>

int main() {
  char input_str[20];
  char *output_str;

  strcpy(input_str, "Hello");
  printf("input_str: %s\n", input_str);

  output_str = strcpy(input_str, "World");

  printf("input_str: %s\n", input_str);
  printf("output_str: %s\n", output_str);

  return 0;
}

It will proiduce following result:

input_str: Hello
input_str: World
output_str: World


previous Printer Friendly

Advertisements


  

Advertisements



Advertisements