Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string.h>
- using namespace std;
- void concatenate(char first_string[], char second_string[])
- {
- int end_of_first_string = strlen(first_string);
- for (int i = 0; i < strlen(second_string); i++)
- {
- int j = end_of_first_string + i;
- first_string[j] = second_string[i];
- }
- first_string[strlen(first_string)] += 0;
- }
- int main()
- {
- char firstname[20] = "YoonA";
- char lastname[20] = "Lim";
- char desiredname[20];
- strcpy_s(desiredname, firstname);
- cout << "Hi " << desiredname << endl;
- cout << "YoonA has " << strlen(desiredname) << " letters in it" << endl;
- concatenate(firstname, lastname);
- cout << firstname;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement