There is 12-elements \*prim array and there is initialized only 7 elements. Here is code:

```
int f(int input)
{
    char *prim[12] = {"2", "3", "5", "7", "11", "13", "17"};
    int i;

    for(i=0; i<12; i++)
    {       
        if(i % input == 0)
        {
            strcat(result, prim[i]);
            strcat(result, " ");
        }
    }

    if(strlen(result) == 0)
    {
        printf("return -1");
    }
    else 
    {
        printf("%s\n", result);
        printf("return 0");
    }
}

```

When i = 8 debugger give me an Access violation reading location.

My friend gave me this sample of exam in programming basics course on his college, and I need to help him passing it.

So, my questions is: is there something i don't know about programming in C, or the professor made a mistake in declaring \*prim?