Question: I have tried every way possible, but I am still not able to logout the current user.
Currently I have the following code:

```
_authenticationManager.SignOut(DefaultAuthenticationTypes.ApplicationCookie);

        string sKey = (string)HttpContext.Current.Session["user"];
        string sUser = Convert.ToString(HttpContext.Current.Cache[sKey]);
        HttpContext.Current.Cache.Remove(sUser);
        HttpContext.Current.Session.Clear();
        HttpContext.Current.Response.Cookies.Clear();
        HttpContext.Current.Request.Cookies.Clear();
        HttpContext.Current.Session.Abandon();

```

After this, the session is still not cleared.
Any ideas?

Authentication startup:

```
  app.UseCookieAuthentication(new CookieAuthenticationOptions
           {
            AuthenticationType = DefaultAuthenticationTypes.ApplicationCookie,
            LoginPath = new PathString("/Account/Login")
        });

```

SignIn Code:

```
    public override ApplicationUser Handle([NotNull]LoginCommand command)
    {
        var user = _userManager.Find(command.Login, command.Password);
        if (user == null)
        {
            throw new RentalApplicationValidationException("No valid login");
        }

        _authenticationManager.SignOut(DefaultAuthenticationTypes.ApplicationCookie);
        var identity = _userManager.CreateIdentity(user, DefaultAuthenticationTypes.ApplicationCookie);
        _authenticationManager.SignIn(new AuthenticationProperties() { IsPersistent = false }, identity);

        return user;
    }

```

Answer: 
Your syntax is wrong, because only the first statement in a `for` preamble is the declaration part — you've attempted to use two statements for that job.

However, you *can* declare multiple variables in a single statement, which is what you presumably intended to do:

```
for (int i = 0, n = 10; n < NAX; i++, n++)
//   ^^^^^^^^^^^^^^^^^

```

Now, these variables only exist for the duration of the loop. That is their "scope". For your next loop, you have to declare them again.

So, instead of this:

```
for(i=0; n=11; n<MAX; i++, n++)

```

repeat the above, substituting `11` for `10` in the new declaration (if that wasn't a typo).

Also, I believe you wrote `input[i]` when you meant `input[n]`. Otherwise `n` is pointless in the first place.
```
void reformat(double input[], double newarray[], int MAX)
{ 
for(int i=0; int n=10; n<MAX; i++, n++)
  {
  newarray[n] = input[i]*2;
  }

for(i=0; n=11; n<MAX; i++, n++)
  {
  newarray[i] = pow(input[n], 0.3);
  }

  return;
}

```

When you declare a variable in a **for** block as you have done here with the variable **i** , it only exists for the duration of the following block.

The second **for** block above needs to declare a new loop variable, since the first i no longer exists, after its block has completed executing.