Memories and large dimention arrays!!!!!

Can anyone help me to solve this problem:

I need to work on matrix of size 512x512, it is not possible to just

define:

int matrix[512][512];

because at compilation, an error will be generated:

"array size too large".

But by allocation for some memory, the problem can be solve!.

Like:

matrix = malloc(**matrix*512*sizeof(int));

and so on!. Can you show me how?

Thank you for any little help.

Shaban