How to have two functions that call each other C++

前端 未结 2 1868
陌清茗
陌清茗 2020-12-01 21:59

I have 2 functions like this that does obfuscation on if loop:

void funcA(string str)
{
    size_t f = str.find(\"if\");
    if(f!=string::npos)
    {
               


        
相关标签:
2条回答
  • 2020-12-01 22:13

    A forward declaration would work:

    void funcB(string str); 
    
    void funcA(string str)
    {
        size_t f = str.find("if");
        if(f!=string::npos)
        {
            funcB(str);        //obfuscate if-loop
        }
    }
    
    void funcB(string str)
    {
         //obfuscate if loop
         funcA(body_of_if_loop);     //to check if there is a nested if-loop
    }
    
    0 讨论(0)
  • 2020-12-01 22:14

    What you want is forward declaration. In your case:

    void funcB(string str);
    
    void funcA(string str)
    {
        size_t f = str.find("if");
        if(f!=string::npos)
        {
            funcB(str);        //obfuscate if-loop
        }
    }
    
    void funcB(string str)
    {
         //obfuscate if loop
         funcA(body_of_if_loop);     //to check if there is a nested if-loop
    }
    
    0 讨论(0)
提交回复
热议问题