On Wed, Nov 9, 2011 at 6:39 PM, Doug Brewer <brewer.d...@gmail.com> wrote:

> If I want to clear out that structure, should I use
>
> memset(bar, 0, sizeof(bar));
> or
> memset(bar, 0, sizeof(*bar));
>

The purpose of this list is not to focus on remedial programming support.
You can help answer your own question by studying & playing with the
following along with studying the memset(3) manpage:

#include <stdio.h>

struct foo {
    int i;
    float f;
 };

int main()
{
    struct foo *bar[10];
    printf("sizeof(struct foo) = %d\n", sizeof(struct foo));
    printf("sizeof(struct foo*) = %d\n", sizeof(struct foo*));

    return 0;
}

The art of programming is learned by writing lots of little programs which
answer questions like these.

Reply via email to