First, I'm not sure how to set an integer pointer to an array. Second, is this the proper way to set pthread\_create arguments?

Here's my argument struct:

```
typedef struct args {
    int *arr;
    int number;
} args;

```

I created a pointer to the struct:

```
args *arguments = (args *)malloc(sizeof(args));

```

I need to set each element of args.arr to argv (command line argument) as an integer. I don't quite understand how to set each element of args.arr:

```
for(i = 1; i < argc; i++)
    arguments->arr[i] = atoi(argv[i]); // Edit: Segmentation fault on this line

```

I created an array of threads:

```
pthread_t threads[4];

```

..and pass the arguments to each function call:

```
for(i = 0; i < 4; i++)
    pthread_create(&threads[i], NULL, func, arguments);

```