error: expected primary-expression before ‘slide’ : <p>I am learning C++ but stuck now. The program of mine is showing the error</p>

<pre><code>error: expected primary-expression before ‘slide’
</code></pre>

<p>I referred <a href="https://stackoverflow.com/questions/11507607/c-expected-primary-expression-before">this</a> but it didn't help!</p>

<pre><code>#include &lt;iostream&gt;
#include &lt;string&gt;
#include &lt;limits.h&gt;

using namespace std;

int minSwapsHelper(string slide, int n){
    int noOfGirls;
    for(int i = 0; slide[i]!='\0'; i++){
        if(slide[i] == 'G'){
            noOfGirls++;
        }
    }
    int tempNoOfGirls = noOfGirls, maxNoOfGirls = INT_MIN;
    int noOfGirlsAtEachItr[n]={0};
    if(slide[0] == 'G'){
        noOfGirlsAtEachItr[0] = 1;
    }
    for(int i = 0; i&lt; n; i++){
        if(slide[i] == 'G'){
            noOfGirlsAtEachItr[i] = noOfGirlsAtEachItr[i-1] + 1;
        }
        else{
            noOfGirlsAtEachItr[i]= noOfGirlsAtEachItr[i-1];
        }
    }

    for(int i = tempNoOfGirls- 1; i &lt; n; i++){
        if(i == (tempNoOfGirls - 1))
            noOfGirls = noOfGirlsAtEachItr[i];
        else
            noOfGirls = noOfGirlsAtEachItr[i] - noOfGirlsAtEachItr[i - tempNoOfGirls];
        if(maxNoOfGirls &lt; noOfGirls){
            maxNoOfGirls = noOfGirls;
        }
    }

    int noOfBoys = tempNoOfGirls - maxNoOfGirls;
    return noOfBoys;
}
int minSwapsToWin(string slide){
    /*int i = 0;
    while(slide[i] != '\0'){
        i++;
    }
    int lengthOfString = i;*/
    int lengthOfString = slide.length();
    return minSwapsHelper(string slide, lengthOfString);
}
 int main(){
 string slide = "BBGBGBG";
 cout&lt;&lt;minSwapsToWin(slide)&lt;&lt;"\n";
 return 0;
 }
</code></pre>

<p>The problem that I have the code the solution for is as follows:</p>

<blockquote>
  <p>Problem: </p>
  
  <p>In a school, the students were playing a game. Initially
  everyone is standing in a circular path in the school lawn. The
  student at index 1 is standing next to student at index n and before
  the student at index 2. All the girls need to stand together to win
  the game. The girls had influencial power to influence the boys to
  swap the positions. Help the Girls decide the minimum number of swaps
  they have to do so that all of them stand together. </p>
  
  <p>Input:BBGBGBG Output:1 Explanation: we can swap the G at index 3 with
  B at index 6 to get all B and G together.</p>
  
  <p>Input:BGBGGB Output:1 Explanation: we can swap B at index 3 with G at
  index 2 to get all B and G together.</p>
</blockquote>
