View unanswered posts | View active topics It is currently Sun Sep 20, 2020 9:50 pm

Reply to topic  [ 3 posts ] 
iterating through string arrays 
Author Message

Joined: Fri Apr 20, 2007 3:22 am
Posts: 36
Post iterating through string arrays

I want to be able to iterate through a string array.

I would expect this to work.

string array[3] = {"apple","box","chair"};

for(cnt =0; $cnt<2; cnt++)

It only displays the first character of the element.



will display "box" to the LCD.

Is this a bug or am I doing something wrong here?

Sun Jun 24, 2007 5:19 pm

Joined: Mon Feb 25, 2008 5:21 am
Posts: 2
I have the same problem too...

Mon Feb 25, 2008 6:12 am
Site Admin
Site Admin

Joined: Wed Jan 24, 2007 10:42 am
Posts: 620
Hi All,

I tried your sample program out. I made a few modifications to the code and it seems to be working. Let me know if this is your desired output:

task main()
   string array[3] = {"apple","box","chair"};

   for(int cnt = 0; cnt<3; cnt++)
   wait1Msec(1000);  //so we can actually see the text on the screen

Timothy Friez
ROBOTC Developer - SW Engineer

Mon Feb 25, 2008 4:11 pm
Display posts from previous:  Sort by  
Reply to topic   [ 3 posts ] 

Who is online

Users browsing this forum: No registered users and 2 guests

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.