Question Details

No question body available.

Tags

c linux libcurl

Answers (1)

May 20, 2026 Score: 2 Rep: 37,789 Quality: Low Completeness: 70%

I found the solution. However, I don't understand why it worked.

You need to allocate space to hold an object of type STRUCT (which x will then point to).

But x itself is a pointer and so sizeof(x) will be the size of the pointer, not what it points to.
On the other hand sizeof(*x) is the size of the entity the pointer points to - i.e. your STRUCT, which is what you need.