SHARE
TWEET

Untitled

a guest Jun 16th, 2019 52 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include<stdio.h>
  2.  
  3. char* strcatt(char[], char[]);
  4.  
  5. int main(void) {
  6.     char S1[] = "University of Colombo";
  7.     char S2[] = "Sri Lanka";
  8.     printf("%sn", strcatt(S1, S2));
  9. return 0;
  10. }
  11.  
  12. char* strcatt(char S1[], char S2[]) {
  13.     int i = 0, j = 0;
  14.     while(S1[i]) {
  15.         i++;
  16.     }
  17.     S1[i++] = ' ';
  18.     while(S1[i] = S2[j]) {
  19.         i++;
  20.         j++;
  21.     }
  22. return (S1);
  23. }
  24.      
  25. char * strcatt( char s1[], const char s2[] )
  26. {
  27.     size_t i = 0, j = 0;
  28.  
  29.     while ( s1[i] ) i++;
  30.  
  31.     s1[i++] = ' ';
  32.  
  33.     while ( s1[i] = s2[j] )
  34.     {
  35.         i++;
  36.         j++;
  37.     }
  38.  
  39.     return s1;
  40. }
  41.      
  42. char S1[32] = "University of Colombo";
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top