My struct is
typedef struct {
unsigned int size ;
int * arr ;
} array_t ;
The function should initialize a struct with the length of a given number.
void init ( array_t * A, unsigned int size){
A = malloc(sizeof(array_t));
A->arr = calloc(size+1,sizeof(int));
A->size = size;
return;
}
But when I print the size of the struct in my main function I always get the wrong number. How do I assign the right value to size or what did I do wrong?