Unable to assign zero to unsigned character array

Hi,

I am unable to assign value zero to my variable which is defined as unsigned char.

    typedef struct ABCD
   {
   unsigned char abc[6];
   unsigned char def;
   unsigned char ghi;
   } ABCD;
   typedef ABCD *PABCD;

In my Por*C code, i assign the values using memcpy like below

void abc(PABCD s_tag)
{
memset((char*)(s_tag), '0',sizeof(s_tag));
memcpy((char*)s_tag.abc,"000000",sizeof(s_tag.abc));
s_tag.def = 0;
s_tag.ghi=0;
}


In debug mode, i could see '\0'.....How to make the value as '0' only:confused:?

(dbx) print -L *s_tag
*s_tag = {
        s_tag.abc  = "000000"
        s_tag.def = '\0'
        s_tag.ghi = '\0'
         }              

I would not expect that code to compile as def, ghi are dereferenced incorrectly.

Further more, it's not clear what you mean when you say zero. Do you mean ASCII code zero or the character zero? You seem to have a mix of both.

I have to get my values like below

(dbx) print -L *s_tag *s_tag = { s_tag.abc = "000000" s_tag.def = '0':b: s_tag.ghi = '0':b: }
but i am getting values like below:
(dbx) print -L *s_tag *s_tag = { s_tag.abc = "000000" s_tag.def = '\0':confused: s_tag.ghi = '\0':confused: }
I have written here sample code like mine. How to assign the value '0' to character array variable def which is defined in structure?

This sets the character zero (not ASCII zero).

#include <string.h>

struct ABCD
{
    unsigned char abc[6];
    unsigned char def;
    unsigned char ghi;
};

void abc(struct ABCD* s_tag)
{
//  memset(s_tag, '0', sizeof(*s_tag));    // this or the stuff below

    memcpy(s_tag->abc, "000000", sizeof(s_tag->abc));
    s_tag->def = '0';
    s_tag->ghi = '0';
}

int main()
{
    struct ABCD var;

    abc(&var);

    return 0;
}