STRING ALGORITHMS
Print this page
STRING CONCATENATION
  • Appending one string to the end of another string is called string concatenation

Example let STR1= "hello"

STR2= "world"

  • If we concatenate STR2 with STR1, then we get the string "helloworld"
Algorithm
  1. i= 0, j=0;
  2. while   STR1[i] != '\o'
  3. i++;
  4. while    STR2[j] != '\o'

    STR1[i]= STR2[j];
    i =i+1
    j = j+1

  5. STR1[i]= '\o';
  6. Return  STR1;
Prev