Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- char* strncat1(char* s1, char* s2, int n)
- {
- char* temp;
- int temp_index;
- temp = new char [n];
- for(int i=0; i<n; i++)
- {
- if(s2[i]!='\0')
- {
- temp[i]=s2[i];
- }
- }
- for(int i=0; s1!='\0'; i++)
- {
- if(s1[i] == '\0')
- {
- temp_index=i;
- }
- }
- for(int i=temp_index; i<n; i++)
- {
- s1[i]=temp[i];
- }
- return s1;
- }
Advertisement
Add Comment
Please, Sign In to add comment