01-21-2007 08:29 AM
01-22-2007 02:19 AM
Hi AnhTruong,
Normally, the code 'sending' the array should inform you of the size of this array. If not, you should check if a 'end of array' special character is added at the end of the array an should look for it in order to determine the array size.
If not, I don't believe you can retrive this information. Note that being out-of-bound must be prohibited. It can lead to unexpected behaviors.
Regards,
01-22-2007 08:33 AM - edited 01-22-2007 08:33 AM
Hi Mathieu,
Is there other ways without including an extra end data of the sending array (might cause the error if array has some values matching the end data) or including the size of the array (an extra parameter)?
Since I want to keep the function call as it is (the caller passing only a raw unknown-size array from other function)
Message Edited by plit string on 01-22-2007 08:36 AM
01-22-2007 08:49 AM
Hi back,
When you pass an array, you pass a pointer to the first element - or to an element you specify. So that if you do not pass the array size, you have no other way than looking for an eventual end of array char to know its size.
Regards,
01-22-2007 10:29 AM
Hi Mathieu,
It is very inconvenient way to do that, because the caller will have the similiar problem, he/she can not add more data to a fix array or he/she can not detect array size ... then we are in a circle again!
Anyway, thanks for the explainations ... might be we have to live with it!
01-27-2007 07:40 AM