Quote:
Originally Posted by billy1
Thank you for you quick answer!
But I still have some questions. Defenitly, I have a conceptual problem which is not described in my books.
All what I did is in my C books (or at least that's what I underestand so far..)

What I wanna do is just a switch or if loop wich -according with a variable I get (x)- then I set some values in an empty defined array.

1 int x;
2
3 x = number; /*here "number" is an int which I get from another function*/
4
5 switch(x) {
6 case 0: int MAT[]={1,2,3,4,5}; /*Initializing the content of an array when it is declared , In my boooks this a correct way to declare an array.. */
7 break;
8 case 1: int MAT[]={3,4,5,6,7};
9 break;
10 default: printf("none selected\n");
11 }

Here I'm getting an error in lines 6 and 8 saying:

error: expected expression before '{' token
error: expected expression before '{' token


I've also tryied setting element by element as you suggested, but I get the same error.

I tried also using "if-else if" , but the same error message in each line!!

Thanks for your help!!