Hello ,
why am I taking :
*** glibc detected *** ./run: double free or corruption (out)
#include <stdio.h>
#include <stdlib.h>
void func1(int **A )
{
*A = (int*) malloc( 2 * sizeof(int));
for (int i = 0; i < 10; i++){
(*A)[ i ] = i;
//printf("\nA = %d\n", (*A)[ i ]);
}
}
int main( int argc, const char* argv[] ){
int *A;
func1( &A );
for (int i = 0; i < 10; i++)
printf("\nA = %d\n", A[ i ]);
free ( A );
return 0;
}
when I free A ?
Thanks!