Question: How can I initialize an array in C such as

```
void initArr(int size)
{
  ...
}

```

The C language does not give the option to initialize an array
if his size is not an constant value, and if I initialize
it generally (int \*arr;) so it gives me error of 'arr' is not
being initialized.

Similarily, how can I do that when I have an array with dimension
bigger than one (matrix, for example)?

Answer: 
The answer that works in C and C++ is dynamic memory allocation

```
int *arr = (int*)malloc(size*sizeof(int));

```

In C++ you would prefer to use new instead of malloc, but the principle is the same.

```
int* arr = new int[size];

```
> 
> The C language does not give the option to initialize an array if his size is not an constant value 
> 
> 
> 

In C99 you can use a variable length array and then initialize it by using a loop. 

> 
> if I initialize it generally (int \*arr;) so it gives me error of 'arr' is not being initialized.
> 
> 
> 

This is because a pointer must be initialized (points to a pointee - excluding NULL) before it is being used in program.