Array subscript out of range?
Author |
Message |
vindicta
|
Posted: Tue May 06, 2008 4:43 pm Post subject: Array subscript out of range? |
|
|
A program I am working on is comparing two strings. When my program gets to this part it always stops and says Array subscript out of range. I can't fix this problem. I think it's because my array or a value in it doesnt exist but when I look through the code it should work fine. What is the actual reason for this error? |
|
|
|
|
|
Sponsor Sponsor
|
|
|
Zampano
|
Posted: Tue May 06, 2008 4:51 pm Post subject: Re: Array subscript out of range? |
|
|
This happened because, as you said, you tried to access an element of the array which did not exist.
What can I say? Check again.
The compiler shows you where the error occurred, so it should be a simple fix. If, by some chance, you were doing some manipulation on an existing value to see which element should be accessed, try to think what value would cause the subscript to leave the range of the array. |
|
|
|
|
|
isaiahk9
|
Posted: Fri May 09, 2008 3:29 pm Post subject: RE:Array subscript out of range? |
|
|
Look for "Trace" in Turing options and you could see where the code goes wrong. |
|
|
|
|
|
andrew.
|
Posted: Mon May 12, 2008 6:56 pm Post subject: RE:Array subscript out of range? |
|
|
Well since you're using strings, I'm pretty sure that each word counts as one individual string. So when you have something like:
put something like:
This allows you to enter as many words as possible for each variable.
Good luck on your program. |
|
|
|
|
|
|
|