Question: a short question here.

I do know that if I declare something like

```
char* a[1024];

```

Then I can compare a[i] with null;

```
if(a[i])

```

However, if I malloc every element in a, then I may not do it...

The only way I can find out to compare it with empty is the following:

```
if(strcmp(a[i],"")!=0)

```

But I feel it is stupid and there must be more elegant way to do the comparison...

Any suggestions?

Thanks!

PS: 
I need to do malloc because I would do strtok. And I want to strcat something to the result, so I cannot just use a[i] as a pointer to the the result, but need to copy the content.

Answer: 
Use `calloc` Instead of `malloc`. Thus your string chars are initialized to `\000` and you can test for it with `if (a[i][0])`.
If you say you allocate every element of a with malloc, then you should have something like:

```
for (int i = 0; i < 1024; i++) {
    a[i] = malloc(size);

```

Given this, why don't you test for the value of a[i]:

```
    if (a[i])
        // error
}

```