Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Herp derp

Name: Anonymous 2011-04-20 12:30

ITT: How you decide the amount of elements in an array in C++ with only a pointer to the array. I bet you can't do it.

Name: Anonymous 2011-04-20 14:49

>>7
u mena

struct hax {
        size_t len;
        void *data[];
};

struct hax *hax_myanus(size_t len)
{
        struct hax *haxed = malloc(sizeof(struct hax) + len * sizeof(void *));

        if (haxed)
            haxed->len = len;

        return haxed;
}

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List