Error: pointer of type `void *' used in arithmetic

Hello,
I'm trying to create a dynamic array containing generic pointers:
1
2
3
4
5
6
void* initTable(int size) {
    void* a = malloc(sizeof(void*)*size);
    for(int i=0; i<size; i++)
        a[i] = NULL;            // LINE 19 - ERROR
    return a;         
}

but I'm getting:
19: pointer of type `void *' used in arithmetic
19 `void*' is not a pointer-to-object type

I can't get where the problem is.
Any idea?
Thank you
You can't do anything with void* pointers except copy and cast them.
When you need a "generic dynamic array", use a vector of the desired base class.
Ok, thank you very much Athar.
Topic archived. No new replies allowed.