Dereference a pointer inside a structure pointer?

As with any pointer. To change the address it points to.

As with any pointer. To change the address it points to: struct_inst->pointer = &var; To change the value at the address to which it points: *(struct_inst->pointer) = var.

Perfect, the second one was what I was looking for. Thanks. – Federico Culloca Apr 5 '10 at 23:34.

You are creating a pointer of type mystruct, I think perhaps you didn't want a pointer: int x; struct mystruct mystruct_inst; mystruct_inst. Pointer = &x; *mystruct_inst. Pointer = 33; Of if you need a mystruct pointer on the heap instead: int x; struct mystruct *mystruct_inst = malloc(sizeof(struct mystruct)); mystruct_inst->pointer = malloc(sizeof(int)); *(mystruct_inst->pointer) = 33; /*Sometime later*/ free(mystruct_inst->pointer); free(mystruct_inst).

I wanted a pointer. The value change takes place inside a function. Plus, I already assigned pointer to a malloc-ed area of memory.

– Federico Culloca Apr 5 '10 at 23:38 1 I guess the answer's point was that your code example didn't show allocating any memory for the struct mystruct, just an uninitialised pointer to such a struct. But of course pointer inside the struct must also point somewhere. =) – Arkku Apr 5 '10 at 23:41.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions