Rohit Arul Raj wrote:
On Fri, Aug 8, 2008 at 12:24 PM, Mateusz Loskot <mateusz@xxxxxxxxxx> wrote:
Rohit Arul Raj wrote:
2. Can i get more details as to why if the size of the array is not
provided the compiler does not insert an string terminator at the end
of the array.
How could that be?
It is an array but not a string literal, so compiler does not append \0 or
any other extra elements to it.
Best regards
--
Mateusz Loskot, http://mateusz.loskot.net
Charter Member of OSGeo, http://osgeo.org
Hi,
If i give the size of the array as 15, like "unsigned char n[15] =
{'a', 'b', 'c','d'};" , then it is appending '\0'.
Rohit,
Yes, this is perfectly correct.
> But if the size of the array is not given "unsigned char n[] ", then
> it is not appending '\0'.
And this is correct behavior and I was referring to the n[] case only.
Sorry for lack of precision.
Does that mean, that if the size of the array is specified, it appends
'\0' and if it is not specified then it does not append '\0'?
Can you/anyone clarify this point?
I believe Jerzy explained it in details.
Best regards,
--
Mateusz Loskot, http://mateusz.loskot.net
Charter Member of OSGeo, http://osgeo.org