On 02/06/2011, at 1:12 AM, JAMES ROGERS wrote:

> K&R says to declare and initialize an array in C:
> 
>       int myArray[2] = {1,2};
> 
> If the above is entered into the .h file


That's because a .h file is the HEADER.

You need to put this in the BODY, which is the .c (pure C) or .m (Obj-C) file. 
The reason is that the = {1,2} part is executable code, not just a declaration, 
so it needs to live somewhere.

--Graham




_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to