[ create a new paste ] login | about

Link: http://codepad.org/DpKhTLTS    [ raw code | output | fork ]

C++, pasted on May 24:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include <iostream>
void str_cpy(char *s, char *t)
{
    int i;
    
    for (i = 0; t[i] != '\0'; i++)
        s[i] = t[i];
    
    s[i] = '\0';
}
int main()
{
    char str1[] = "tst";
    char str2[] = "th";
    str_cpy(str2, str1);
    std::cout<<str2;
    return 0;
}


Output:
1
tst


Create a new paste based on this one


Comments: