I agree with you, but I guess he missed semicolon just before an array
declaration because he got *compiler* error, not linker!
Correct declaration could be of two forms:
1) In header file
static int a[2] = {1,2};
or
static int a[] = {1,2};
2) In header file
extern int a[2];
In *.m file:
int a
On Jun 1, 2011, at 8:17 AM, Graham Cox wrote:
>
> 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 ne
On 1 Jun 2011, at 8:17 AM, Graham Cox wrote:
> 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};
>> ArrayTestAppDelegate.h:14: error: expected ':', ',', ';', '}' or
>> '__attribute__' before '=' token
If I cop
>> 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
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) f
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 of a cocoa project, the compile will
fail with the following:
/Users/jimrogers_w4atk/Development/workspace/ArrayTest/ArrayTestAppDelegate.h:14:0
/Users/jimrogers