|
From: | James Hamilton |
Subject: | Re: [avr-gcc-list] String declaration query |
Date: | Sun, 6 Jul 2014 13:09:25 -0400 |
Big Difference. The first defines an array of characters and initializes it with the string "Hello There". In doing so, it even determines the size of the array for you. Note: there is one more character than you might expect because every C string ends with a null character that you don't see.
The second does not even define a variable. A char just holds one character. But, you have not even specified a variable that the type char applies to.
The two are totally different.
Jim Wagner
Oregon Research Electronics
On Jul 6, 2014, at 9:00 AM, address@hidden wrote:
> Date: Sun, 6 Jul 2014 18:33:40 +0530
> From: Royce Pereira <address@hidden>
> To: "address@hidden" <address@hidden>
> Subject: [avr-gcc-list] String declaration query
> Hi,
>
> What is the differenence between:
>
> __flash const char myString[] = "Hello There!" ;
>
> and
>
> __flash const char *myString = "Hello There!" ;
>
> AFAIK, both should be same, but the 2nd gives the error:
>
> " ... initializer element is not computable at load time"
>
> Am I writing it wrong ?
>
> Thanks.
> --
> Best Regards,
>
> -- Royce Pereira
>
[Prev in Thread] | Current Thread | [Next in Thread] |