Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- char * strCat(char *destination, const char*entered) {
- int length = 0;
- if (destination == "") {
- length = 0;
- }
- else {
- for (size_t i = 0; destination[i] != '\0'; i++)
- {
- length++;
- }
- }
- int i = 0;
- while (entered[i] != '\0') {
- destination[length + i] = entered[i];
- i++;
- }
- return destination;
- }
- int main()
- {
- char buffer[100]="";
- strCat(buffer, "dario");
- strCat(buffer, "e");
- strCat(buffer, "najjak");
- strCat(buffer, " ");
- std::cout << strCat(buffer, "covek");
- std::cin.get(); std::cin.get();
- }
Advertisement
Add Comment
Please, Sign In to add comment