ch 10/e9.c
//Function to store a sub string inside a main string

Function to store a sub string inside a main string
Function to store a sub string inside a main string
void insertString ( char m_text [], char s_text [], int index )
 {
 	char buffer [51] ;
	int i = 0 ;
	for ( ; m_text [i] != '\0'; i++ )		
	 buffer [i] = m_text [i] ;
	buffer [i] = '\0' ;
	int m_elem = strlen ( m_text ) ;
	int s_elem = strlen ( s_text ) ;
	int m_index = index ;
	for ( int i = 0; i < s_elem; i++ )		
	 {
	 	m_text [m_index] = s_text [i] ;
		m_index ++ ;
	 }
	while ( buffer [index] != '\0' )		
	 {
	 	m_text [index + s_elem] = buffer [index] ;
		index++ ;
	 }
	m_text [index + s_elem] = '\0' ;
 }
void insertString ( char m_text [ ] , char s_text [ ] , int index ) { char buffer [ 51 ] ; int i = 0 ; for ( ; m_text [ i ] != ' \0 ' ; i ++ ) buffer [ i ] = m_text [ i ] ; buffer [ i ] = ' \0 ' ; int m_elem = strlen ( m_text ) ; int s_elem = strlen ( s_text ) ; int m_index = index ; for ( int i = 0 ; i < s_elem ; i ++ ) { m_text [ m_index ] = s_text [ i ] ; m_index ++ ; } while ( buffer [ index ] != ' \0 ' ) { m_text [ index + s_elem ] = buffer [ index ] ; index ++ ; } m_text [ index + s_elem ] = ' \0 ' ; }
Function to store a sub string inside a main string
Function to store a sub string inside a main string
//Copying main string to a buffer 
 //Copying sub text into main string
 //Copying required text back into main string from the buffer
