Take a first name and a last name and combines the two strings : String Copy « String « C Tutorial

Home
C Tutorial
1.Language
2.Data Type
3.String
4.printf scanf
5.Operator
6.Statement
7.Array
8.Function
9.Structure
10.Pointer
11.Memory
12.Preprocessor
13.File
14.Data Structure
15.Search Sort
16.Wide Character String
17.assert.h
18.ctype.h
19.math.h
20.setjmp.h
21.signal.h
22.stdio.h
23.stdlib.h
24.string.h
25.time.h
26.wctype.h
C / ANSI-C
C++
C++ Tutorial
Visual C++ .NET
C Tutorial » String » String Copy 
3.8.2.Take a first name and a last name and combines the two strings
#include <string.h>
    #include <stdio.h>
    int main()
    {
        char first[100];
        char last[100];
        char full_name[200];


        strcpy(first, "first");
        strcpy(last, "last");

        strcpy(full_name, first);


        strcat(full_name, " ");
        strcat(full_name, last);

        printf("The full name is %s\n", full_name);

        return (0);
    }
The full name is first last
3.8.String Copy
3.8.1.Copying a string using array notation and pointer notation
3.8.2.Take a first name and a last name and combines the two strings
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.