I have a little problem passing a pointer inside a void. This void show only the firts position of the array of struct. When the loop go to second position i get "segmentation fault".I tried to show the array inside the main with the same loop and it works.What's the problem?
typedef struct starr{
char string[100];
int occ;
} starr;
int main(){
int n;
starr *array_str;
//insert n and array_str
array_str=(starr *)malloc(sizeof(starr)*n);
view(&array_str,n);
}
void view(starr *array_str, n){
int i;
for(i=0;i<n;i++){
printf("String %s",array_str[i]->string);
}
}