Question: Basically, let's say I declare an array in int main() and then pass it to another function, can i then change what values the array holds? Something like:

```
int main()
{
  myarray[3] = {4, 5, 6};

  myfunc(myarray);

 return 0;
}

int myfunc(int myarray[])
{
  int x
  cout << "Choose a number";
  cin >> x

  if (x == 1)
   {
     myarray[] = {0, 1, 3}
   } 
  else
   {
     some code
   }

return 6;
}

```

This code obviously does not compile, but I can't really think of any other ways to change the values in the array within the function.

Answer: 
You can modify elements in the array however initializer lists like this:

```
myarray[] = {0, 1, 3}

```

can only be used when you declare the array. To assign to the array you will have to assign each element individually:

```
myarray[0] = 0;
myarray[1] = 1;
myarray[2] = 3;

```
```
if (x == 1)
{
  myarray[] = {0, 1, 3}  // {0,1,3} is an initializer list.
} 

```

Initializer lists are allowed only at the point of declaration. They are not allowed in assignments. And in the if statement, you are doing an assignment. The only way of modifying the array elements is by changing element at each index in the `if`.

```
myarray[0] = 0;
myarray[1] = 1;
myarray[2] = 3;

```