I have a struct defined like this:
struct Queries {
    uint64_t Id;
    uint64_t from;  
    uint32_t counter; // total queries
    char queries[];
};
What I am trying to do is create a new struct "object" and copy the values from an existing one to this new object.
What I tried
void function(Queries* oldq){
    Queries* q = new Queries();
    // values are copied correctly
    q->Id = oldq->Id;
    q->from = oldq->from;
    q->counter = oldq->counter;
    // copy is not correct
    for (unsinged i = 0; i < oldq->counter; i++)
          q->queries[i] = oldq->queries[i];
}
1) I also tried:
q = oldq;
but this does not work.
2) I think I have to allocate counter * sizeof(char) space for the queries array but since the struct's member is not a pointer I don't know how to do this.
 
     
     
     
    