To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.rcx.nqcOpen lugnet.robotics.rcx.nqc in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / RCX / NQC / 1209
1208  |  1210
Subject: 
Re: RCX 2.0 Arrays
Newsgroups: 
lugnet.robotics.rcx.nqc
Date: 
Sat, 25 Aug 2001 22:46:30 GMT
Viewed: 
2391 times
  
The NQC manual says...

"Neither arrays nor their elements can be used with the increment (++) or
decrement (--) operators."

I guess it's not quite C :-)


"Frank Caggiano" <caggiano@crystal-objects.com> wrote in message
news:3B880F15.7745E737@crystal-objects.com...

I wanted to increment the value contained in an array. I did array[0]++;

NQC complained:

ERROR expression is not a legal target for assignment.

The carrot under array[0]++ pointed to the index value, that is the 0.
It seems NQC thought I was trying to increment the index and not the
value.  In c, at least, you would do array[x++] to increment the index.

NQC doesn't complain about array[x++] = y and it appears to do the
correct thing.
Y goes into array[x] and x is incremented.

Hope this makes sense.

--
Frank Caggiano "The best education for the best
caggiano@crystal-objects.com is the best education for all."
http://www.crystal-objects.com/    Robert M. Hutchins

Logo Users Ring
http://www.crystal-objects.com/logo/logoring.html



Message has 2 Replies:
  Re: RCX 2.0 Arrays
 
(...) Manual? Manual! We don't need no stinking manual. Thanks, ("I guess I should read it", he says sheepishly) (23 years ago, 26-Aug-01, to lugnet.robotics.rcx.nqc)
  Re: RCX 2.0 Arrays
 
(...) Fixing that has been on the to-do list for a long time. But it just isn't a high priority since there are easy workarounds. Right now adding USB support is top priority. Dave Baum (23 years ago, 26-Aug-01, to lugnet.robotics.rcx.nqc)

Message is in Reply To:
  RCX 2.0 Arrays
 
I wanted to increment the value contained in an array. I did array[0]++; NQC complained: ERROR expression is not a legal target for assignment. The carrot under array[0]++ pointed to the index value, that is the 0. It seems NQC thought I was trying (...) (23 years ago, 25-Aug-01, to lugnet.robotics.rcx.nqc)

4 Messages in This Thread:


Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact

This Message and its Replies on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR