src/function.c
bool reservedCPP(char* str)
{
    int key = hashfunction(str);
    
    /**
     * COLLISION SOLUTION
     * Added initial shift value to key
     * 
     * 349-continue
     * 209-class 
     * 181-goto 
     * 356-operator 
     * 249-public
     **/
    char ch = str[0];
    switch (ch)                                             // faster mechanism for comparing strings
    {
        case 'c':
            {
                ch = str[1];
                switch (ch)
                {
                    case 'o':
                        if(strcmp(str,"continue")==0)
                        {
                            key++;
                        }
                        break;
                    case 'l':
                        if(strcmp(str,"class")==0)
                        {
                            key++;
                        }
                        break;
                    default:
                        break;
                }
            }
            break;
        case 'g':
            if(strcmp(str,"goto")==0)
            {
                key++;
            }
            break;
        case 'o':
            if(strcmp(str,"operator")==0)
            {
                key++;
            }
            break;
        case 'p':
            if(strcmp(str,"public")==0)
            {
                key++;
            }
            break;
        default:
            break;
    }

    if(key<0 || key>HASHSIZE)                                   // if the key is not valid       
    {
        return false;
    }
    else if(HASH[key]!=NULL && strcmp(str,HASH[key])==0)        // if key found
    {
        return true;
    }
    else
    {
        return false;
    }
}
/**
 * it will search a string in the collection of reserved words in C++ language
 * 
 * @param search string
 * 
 * @return bool
 **/
it will search a string in the collection of reserved words in C++ language

@param search string

@return bool
it will search a string in the collection of reserved words in C ++ language @param search string @return bool
bool reservedCPP(char* str)
{
    int key = hashfunction(str);
    char ch = str[0];
    switch (ch)                                             
    {
        case 'c':
            {
                ch = str[1];
                switch (ch)
                {
                    case 'o':
                        if(strcmp(str,"continue")==0)
                        {
                            key++;
                        }
                        break;
                    case 'l':
                        if(strcmp(str,"class")==0)
                        {
                            key++;
                        }
                        break;
                    default:
                        break;
                }
            }
            break;
        case 'g':
            if(strcmp(str,"goto")==0)
            {
                key++;
            }
            break;
        case 'o':
            if(strcmp(str,"operator")==0)
            {
                key++;
            }
            break;
        case 'p':
            if(strcmp(str,"public")==0)
            {
                key++;
            }
            break;
        default:
            break;
    }
    if(key<0 || key>HASHSIZE)                                   
    {
        return false;
    }
    else if(HASH[key]!=NULL && strcmp(str,HASH[key])==0)        
    {
        return true;
    }
    else
    {
        return false;
    }
}
bool reservedCPP ( char * str ) { int key = hashfunction ( str ) ; char ch = str [ 0 ] ; switch ( ch ) { case ' ' : { ch = str [ 1 ] ; switch ( ch ) { case ' ' : if ( strcmp ( str , " " ) == 0 ) { key ++ ; } break ; case ' ' : if ( strcmp ( str , " " ) == 0 ) { key ++ ; } break ; default : break ; } } break ; case ' ' : if ( strcmp ( str , " " ) == 0 ) { key ++ ; } break ; case ' ' : if ( strcmp ( str , " " ) == 0 ) { key ++ ; } break ; case ' ' : if ( strcmp ( str , " " ) == 0 ) { key ++ ; } break ; default : break ; } if ( key < 0 || key > HASHSIZE ) { return false ; } else if ( HASH [ key ] != NULL && strcmp ( str , HASH [ key ] ) == 0 ) { return true ; } else { return false ; } }
it will search a string in the collection of reserved words in C++ language
it will search a string in the collection of reserved words in C ++ language
/**
     * COLLISION SOLUTION
     * Added initial shift value to key
     * 
     * 349-continue
     * 209-class 
     * 181-goto 
     * 356-operator 
     * 249-public
     **/ // faster mechanism for comparing strings // if the key is not valid        // if key found