*(char**) how to understand this construct?

Posted by House.Lee on Stack Overflow See other posts from Stack Overflow or by House.Lee
Published on 2012-06-10T03:28:22Z Indexed on 2012/06/10 4:40 UTC
Read the original article Hit count: 117

Filed under:
|

recently, while reading former's code in my current project, I encounter the problems below:

while implementing the Queue, my former wrote codes like this:

while(uq->pHead)
{
    char *tmp = uq->pHead;
    uq->pHead = *(char **)tmp;
    //...
}

the uq->pHead has definition like:

typedef struct {
        char* pHead;
        //...
} Queue;

Well, I'm quite confused about the usage that "uq->pHead = *(char**)tmp" , could anyone explain it to me in detail?

if we assume that *(uq->pHead) = 32(i.e. ' ') , *(char**)tmp would translate this into pointer-form, but...how could it make sense?

Thanks a lot.

© Stack Overflow or respective owner

Related posts about c++

Related posts about c