[Error] invalid conversion from 'int' to 'void*' [-fpermissive]

Hi, i'm a beginner and i don't know what does this error mean. Please help me.
The error is at the line 26, in the function free (i think it is a function)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <stdio.h>
#include <stdlib.h>

int main() {
int **x;
int i,j;
int v[i][j];
int m,n;
printf ("Numero di righe della matrice: ");
scanf ("%d",&m);
printf ("Numero di colonne della matrice: ");
scanf ("%d",&n);
x = (int**) malloc(m*n*sizeof(int));
// Inizializzo anche tutti i sotto-vettori,
// ovvero le righe della matrice
for (i=0; i<m; i++)
x[i] = (int*) malloc(n*sizeof(int));
for (i=0; i<m; i++)
for (j=0; j<n; j++) {
printf ("Elemento [%d][%d]: ",i+1,j+1);
scanf ("%d",&v[i][j]);
}
for (i=0; i<m; i++)
for (j=0; j<n; j++)
printf ("Elemento [%d][%d]: %d\n",i+1,j+1,v[i]);
free(m);
return 0;
}
m is an int, not a pointer.
so how can i solve that?
Get rid of line 26. m is created on the stack so does not need to be freed.
ok now it goes. Thank you very much!!
Topic archived. No new replies allowed.