Recently, I'm learning C. I found a question on the internet. The question is:

> 
> What is the problem with this function in terms of memory allocation?
>  What is a good solution? You may assume that a struct item type has
>  been declared. The purpose of this function is to allocate an array of
>  struct item, which you may assume has been declared prior to this
>  function.
> 
> 
> 
> ```
> BOOLEAN allocate_items(struct item * items, size_t howmany)
> { 
>    size_t count; 
>    items = malloc(sizeof(struct item) * howmany); 
> 
>    if(!items) { 
>       perror("failed to allocate memory"); 
>       return FALSE; 
>    }
>    return TRUE;
> 
> }
> 
> ```
> 
> 

So, I think that the 4th line is wrong. It should be like:

```
items = malloc(sizeof(struct item));

```

And also the 6th line is wrong. It should be like:

```
if(items == NULL){

```

Is it correct?