Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /******************************************************************************
- Online C++ Compiler.
- Code, Compile, Run and Debug C++ program online.
- Write your code in this editor and press "Run" button to compile and execute it.
- *******************************************************************************/
- #include <iostream>
- unsigned stringlen(const char *str)
- {
- unsigned cnt = 0;
- while( *str != '\0')
- {
- str++;
- cnt++;
- }
- return cnt;
- }
- void strcat(char *to, const char *from)
- {
- }
- int main()
- {
- char a[] = "C-style string";
- char b[] = "JOPA";
- char *to = &a[0];
- char *from = &b[0];
- unsigned lenA = stringlen(a);
- unsigned lenB = stringlen(b);
- // to+= lenA;
- for(int i = 0 ; i!= lenB ; i++)
- {
- *to=*from;
- to++;
- from++;
- }
- to-= lenB + 1;
- for(int i = 0; i<= stringlen(a); i++)
- {
- std::cout<<*to;
- to++;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement