Is there a way to do this?

General discussion on mikroPascal PRO for PIC32.
Post Reply
Author
Message
LGR
Posts: 3204
Joined: 23 Sep 2004 20:07

Is there a way to do this?

#1 Post by LGR » 17 May 2012 22:58

I'd like to have an array of constant strings, something like:

Code: Select all

const mess : array [11] of string [16] = ('ABCDEFGHIJKLMNOP'
'ABCDEFGHIJKLMNOP'
'ABCDEFGHIJKLMNOP'
'ABCDEFGHIJKLMNOP'
'ABCDEFGHIJKLMNOP'
'ABCDEFGHIJKLMNOP'
'ABCDEFGHIJKLMNOP'
'ABCDEFGHIJKLMNOP'
'ABCDEFGHIJKLMNOP'
'ABCDEFGHIJKLMNOP'
'ABCDEFGHIJKLMNOP');
Compiler doesn't like this. Is it possible to have complex constants like this?
If you know what you're doing, you're not learning anything.

janni
Posts: 5373
Joined: 18 Feb 2006 13:17
Contact:

Re: Is there a way to do this?

#2 Post by janni » 17 May 2012 23:12

Just add commas between strings (array elements) and it'll be accepted :) .

LGR
Posts: 3204
Joined: 23 Sep 2004 20:07

Re: Is there a way to do this?

#3 Post by LGR » 17 May 2012 23:18

I realized that about 5 seconds before the email notification of your comment arrived. :shock: :evil: :mrgreen:
If you know what you're doing, you're not learning anything.

janni
Posts: 5373
Joined: 18 Feb 2006 13:17
Contact:

Re: Is there a way to do this?

#4 Post by janni » 17 May 2012 23:56

I thought you eventually would :) . It still seemed worthwhile to point it out as (at least from my experience :wink: ) it's so easy to miss the obvious.

JimKueneman
Posts: 417
Joined: 10 Jan 2009 22:03

Re: Is there a way to do this?

#5 Post by JimKueneman » 18 May 2012 03:14

Don't feel bad I have asked at least 2-3 times here and in the Delphi group how to defined constant arrays.... I don't know why the syntax seems to be a mental block for me.

Jim

Post Reply

Return to “mikroPascal PRO for PIC32 General”