Malloc an array of struct pointers vs array of structs?

The first allocates an array of struct and the other allocates an array of pointers to struct . In the first case, you can write to fields by assigning ptr0. Field1 = value right away, while in the second case you must allocate the struct itself before doing the actual writing.

The function malloc doesn't deal in structures or pointers. It only understands bytes. So the first allocates enough bytes for n struct test objects, which the second allocates enough space for n struct test * objects.

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