I am using sizeof to doa memcpy but run into probs because of the
following problem.
static char arr1[] = {0x01,0x00,0x03 ,0x04};
static char arr2[] = {0x00,0x03,0x04 ,0x06,0x07};
const char* string_CDR[8]= {arr1,arr2};
cout<<"The size of is " <<sizeof(arr1)< <" and "<<sizeof(a rr2) <<endl;
cout<<"The size of is " <<sizeof(string _CDR[0])<<" and
"<<sizeof(strin g_CDR[1]) <<endl;
I expect the sizeof(string_C DR[0]) to be 4 and of
sizeof(string_C DR[1]) to be 5. But the output is as below.
The size of is 4 and 5
The size of is 4 and 4
This is messing up my memcpy in the main function as the sizeof is not
what I am expecting. Can anyone point out the problem.
Thanks
Manny
following problem.
static char arr1[] = {0x01,0x00,0x03 ,0x04};
static char arr2[] = {0x00,0x03,0x04 ,0x06,0x07};
const char* string_CDR[8]= {arr1,arr2};
cout<<"The size of is " <<sizeof(arr1)< <" and "<<sizeof(a rr2) <<endl;
cout<<"The size of is " <<sizeof(string _CDR[0])<<" and
"<<sizeof(strin g_CDR[1]) <<endl;
I expect the sizeof(string_C DR[0]) to be 4 and of
sizeof(string_C DR[1]) to be 5. But the output is as below.
The size of is 4 and 5
The size of is 4 and 4
This is messing up my memcpy in the main function as the sizeof is not
what I am expecting. Can anyone point out the problem.
Thanks
Manny
Comment