ch 10/e9.c
//Function to test if a sub string exists inside main string
//If it does, returns index number from where it starts, else returns -1

Function to test if a sub string exists inside main string
If it does, returns index number from where it starts, else returns -1
Function to test if a sub string exists inside main string If it does returns index number from where it starts else returns - 1
int findString ( char main_text [], char sub_text [] )
	{
		int m = 0 ;		
		char tester [21] ; 	
		int sub_length = strlen ( sub_text ) ;		
		void substring ( char source [], int start, int count, char result [] ) ;		
		bool equalStrings ( char string1 [], char string2 [] ) ;
		while ( main_text [m] != '\0' )
			{
				if ( main_text [m] == sub_text [0] )
					{
						substring ( main_text, m, sub_length, tester ) ;		
						if ( equalStrings ( tester, sub_text ) )		
							return m ;
					}
				m++ ;
			}
		return -1 ;		
	}
int findString ( char main_text [ ] , char sub_text [ ] ) { int m = 0 ; char tester [ 21 ] ; int sub_length = strlen ( sub_text ) ; void substring ( char source [ ] , int start , int count , char result [ ] ) ; bool equalStrings ( char string1 [ ] , char string2 [ ] ) ; while ( main_text [ m ] != ' \0 ' ) { if ( main_text [ m ] == sub_text [ 0 ] ) { substring ( main_text , m , sub_length , tester ) ; if ( equalStrings ( tester , sub_text ) ) return m ; } m ++ ; } return -1 ; }
Function to test if a sub string exists inside main string
If it does, returns index number from where it starts, else returns -1
Function to test if a sub string exists inside main string If it does returns index number from where it starts else returns - 1
//Index variable for main text
 //Buffer to test string equality
 //Storing length of sub string
 //Function declarations
 //Storing sub string equivalent length buffer from main string
 //Checking buffer and sub string for equality
 //If sub string not found in main string											
