Subject:
|
Re: start_process question....
|
Newsgroups:
|
lugnet.robotics.handyboard
|
Date:
|
Mon, 13 May 2002 13:41:15 GMT
|
Viewed:
|
8346 times
|
| |
| |
In lugnet.robotics.handyboard, Duane Ribron writes:
> I am writing a program based mainly on Fred Martin's book. The code is prety
> close to his program, but when I try to load I keep getting the following
> error codes, "attempt to use <int> as an array", and, "too many argumentd
> given to , front_motors". Anyway I cant figure it out, as I have said as far
> as I can tell it is pretty much the same code. Anyway6 below is a small
> section of the code, the rest of it is pretty much just as this section is.
>
> int pid=0;
> int process_name;
> int process_priority;
> void(){
> while(1){
>
> process_priority[pid]=1;
> proicess_name[pid]="forward";
> start_process(forward_motors(pid++));
>
> }}
first off, "proicess_name" should be "process_name", but thats not your
problem. You are trying to use an integer as an array in this snippet. You
have "int process_priority;" and then try to treat it as an array in
"process_priority[pid]=1;" I don't know how IC is compared to C, but to
define an array of integers you must follow the basic form:
"int array_name[10];"
remember, the compiler is your best friend, so if it says that you are using
an integer as an array then you prolly are...so then check your variable
declarations for integers that are not integer arrays.
~stephen
btw, it helps in debugging and readability if you dont line your close
braces up in a row "}}"; instead, have them all on the same line as their
corresponding open braces...just a random tip ;-)
example:
int main()
{
// fill the screen with "hello" messages
while(1)
{// {} lined up in a nice straight line...
cout << "Hello World!" << endl;
// OR
printf("Hello World!\n");
}
return 0;
}
|
|
Message is in Reply To:
| | start_process question....
|
| I am writing a program based mainly on Fred Martin's book. The code is prety close to his program, but when I try to load I keep getting the following error codes, "attempt to use <int> as an array", and, "too many argumentd given to , (...) (23 years ago, 13-May-02, to lugnet.robotics.handyboard)
|
2 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|