Example
#include
typedef struct tagMyTestType {
char TypeA;
int TypeB;
} MyTestType;
void TestApp1(void)
{
MyTestType t1;
MyTestType t2;
// add test code
//memset(&t1, 0x00, sizeof(MyTestType));
//memset(&t2, 0xFF, sizeof(MyTestType));
t1.TypeA = 100;
t1.TypeB = 100;
t2.TypeA = 100;
t2.TypeB = 100;
int nReturn = 0;
nReturn = memcmp(&t1, &t2, sizeof(MyTestType));
if (nReturn == 0)
{ // Equal
printf("Equal\n");
}
else
{ // Not Equal
printf("Not Equal\n");
}
}
Can you guess the result?
No comments:
Post a Comment