Dynamic matrix

I want to create 2D array, what’s wrong with this code?

Code:

int x,y;
int* vector = (int*)malloc(sizeof (int) * x);
for(int i=0;i<2; i++)
{
int* vector_[/glow]=(int*)malloc(sizeof (int) y);_
}[/quote]*
You have not defined values for x and y, so they will contain garbage. You are then defining an array of garbage size.
You are declaring a local variable, vector, in the for loop. It will go out of scope when the loop ends. The variable is an array of pointers to ints that you are trying to value with a single pointer to int, of garbage size.
Do you realize how much (actually, how little) SRAM the Arduino has for arrays?
If you correctly define vector, which, as AWOL points out, is a lousy name for a 2D array, you will need to pass the dimensions to any function that uses that array, and to free the memory used by the array when you are done with it.