Declaring empty array

Regarding:

const char HW[]="";

You indicated that unreal would chuck a wobbly but I suspected it was valid code, and I found unity compiled it happily.

When you said unreal would chuck a wobbly - were you referring to someone attempting to declare this empty array who then might attempt to change it? (The error then would be thrown by the compiler because it was declared as ‘const’.)

Yes though it’s not really limited due to the constness of it. char HW[] = "" would be mean that the array is of length 1 and that’s all it will ever be, it cannot grow in size.

Thanks!

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms