Get the return from strcpy() - C String

C examples for String:String Function

Description

Get the return from strcpy()

Demo Code

#include <stdio.h>
#include <string.h>    // declares strcpy()

#define WORDS  "test"
#define SIZE 40//from w w  w. j av a 2  s  .  co  m

int main(void)
{
    const char * orig = WORDS;
    char copy[SIZE] = "this is a test.";
    char * ps;
    
    puts(orig);
    puts(copy);
    ps = strcpy(copy + 7, orig);
    puts(copy);
    puts(ps);
    
    return 0;
}

Result


Related Tutorials