Function to copy string ( Iterative and Recursive ) | Iterative C # Program to copy one String to another . ; Function to copy one string to other assuming that other string has enough space . ; Driver code
using System ; class GFG { static void myCopy ( char [ ] s1 , char [ ] s2 ) { int i = 0 ; for ( i = 0 ; i < s1 . Length ; i ++ ) s2 [ i ] = s1 [ i ] ; } public static void Main ( String [ ] args ) { char [ ] s1 = " GEEKSFORGEEKS " . ToCharArray ( ) ; char [ ] s2 = new char [ s1 . Length ] ; myCopy ( s1 , s2 ) ; Console . WriteLine ( String . Join ( " " , s2 ) ) ; } }