H
Hans B
Please bear with me if I ask silly questions....I am a somewhat newbie to
the C language....
If I had:
struct test1_{
unsigned char mycount1[256];
unsigned short mycount2[256];
unsigned short mycount3;
unsigned short mycount4;
unsigned short mycount5;
unsigned char mycount6;
unsigned char mycount7;
};
struct test2_{
unsigned int mycount8;
unsigned int mycount9;
unsigned short mycount10;
unsigned short mycount11;
unsigned short mycount12;
unsigned int mycount13;
unsigned int mycount14;
unsigned short mycount15;
unsigned short mycount16;
};
struct test3_{
unsigned int mycount17;
unsigned int mycount18;
unsigned short mycount19;
unsigned int mycount20;
};
struct my_data{
struct test1_ test1;
struct test2_ test2;
struct test3_ test3;
}mydatastruct;
I could do:
memset(&mydatastruct, 0, sizeof(mydatastruct));
To clear all variables listed in the struct. But what If I only would like
to clear the variables enclosed in struct test2 and test3, but keep/not
touch the values in test1?
Could this be done?
Best Regards
Hans
the C language....
If I had:
struct test1_{
unsigned char mycount1[256];
unsigned short mycount2[256];
unsigned short mycount3;
unsigned short mycount4;
unsigned short mycount5;
unsigned char mycount6;
unsigned char mycount7;
};
struct test2_{
unsigned int mycount8;
unsigned int mycount9;
unsigned short mycount10;
unsigned short mycount11;
unsigned short mycount12;
unsigned int mycount13;
unsigned int mycount14;
unsigned short mycount15;
unsigned short mycount16;
};
struct test3_{
unsigned int mycount17;
unsigned int mycount18;
unsigned short mycount19;
unsigned int mycount20;
};
struct my_data{
struct test1_ test1;
struct test2_ test2;
struct test3_ test3;
}mydatastruct;
I could do:
memset(&mydatastruct, 0, sizeof(mydatastruct));
To clear all variables listed in the struct. But what If I only would like
to clear the variables enclosed in struct test2 and test3, but keep/not
touch the values in test1?
Could this be done?
Best Regards
Hans