Help with Serial.println and 2D arrays

Hello, as is obvious in the topic, I've been having trouble with Serial.println and accessing information in my 2D arrays. Whenever I try to read information in these, the board seemingly resets itself rapidly (it displays the messages in the setup loop over and over and over). Additionally, when it does work, I've occasionally had problems with the last variable in my array being replaced by a non-related character (-55 was replaced by ASCII character 253).

Is there a behavior of Serial.println that I've missed in the documentation?

Here's an excerpt of the code I'm using, distilled to the basics:

const double InnerRef[6][3] = {{ 0,           -25,   -55},
                               { 0,            25,   -55},
                               { 21.65063509,  12.5, -55},
                               {-21.65063509, -12.5, -55},
                               {-21.65063509,  12.5, -55},
                               { 21.65063509, -12.5, -55}};

     
void setup() {

Serial.begin(9600);  

  for(int i; i > 6; i++){
    for(int j; j > 3; j++){  
      Serial.println(InnerRef[i][j]);
      delay(100);
      }
    }
}

void loop() {
}
  for(int i; i > 6; i++){    //no initialiser for the value of i.  i can go beyond the number of array elements
    for(int j; j > 3; j++){  //no initialiser for the value of j.  j can go beyond the number of array elements

Wow, I can't believe I made that mistake in my troubleshooting code. Thanks for the help.

  for(int i; i > 6; i++){

Starting with i at some unknown value, while i is greater than 6, do something and then increment i. If i starts at 1435, you are reading beyond the end of the array. If i starts at -182, you won't iterate at all.

If you do initialize i to 0, you won't iterate at all.

Sorry, in my real code, I did not make this novice mistake.

Are there rules about using Serial.println within functions?

Are there rules about using Serial.println within functions?

Only one. All Serial.println() statements must be in functions.

Sorry, in my real code, I did not make this novice mistake.

Then why post an example that looks nothing like your real code? Better to post you real code, isn't it?

Maybe you've got a pointer going astray somewhere.
Without seeing your code, we're all just guessing (aka wasting our time)

When I include the Serial.println, the issues begin.

What issues do you have ?

When I include the Serial.println in the excerpt I included in my previous post, the board seems to rapidly automatically reset. Further, nothing shows up in the serial monitor.

Mark_MedPhys:
When I include the Serial.println in the excerpt I included in my previous post, the board seems to rapidly automatically reset. Further, nothing shows up in the serial monitor.

How do you expect us to reproduce your issue?

But, it it's excerpts you like, here is an excerpt from the answer.

It is clear that the problem is .... Fix that, and all will work.

I'm not putting my entire code up.

I had not expected anyone to reproduce the issue. Rather, I was hoping that someone had encountered a similar issue in a similar situation. If you know about any bugs with the command in question, or any useful tips that you can share with a newbie-level poster, I would appreciate it. Otherwise, go on with your day.

If anyone believes that they're wasting their time reading this, they really must be wasting their time in replying.

You have three choices, as I see it.

  1. post all of your code, so we can try to reproduce the problem
  2. live with the problem
  3. solve it yourself

they really must be wasting their time in replying.

Won't happen again, trust me.

Why is the serial monitor coming up blank?

Because Serial.begin() is missing.

Thank you Paul. You have been very helpful.

Because Serial.begin() is missing.

The OP was looking for a simple answer.

Just wait, you cannot get simpler than that!

I think there is pie on someone's face, OP.
.

Unfortunately, adding Serial.begin(9600) to the beginning of the setup loop did not solve the problem.

Put a Serial.print somewhere you know it will work, does it?

.

But it did change the problem.
Having variables of the same name with global and local scope can be confusing.
Having large amounts of data on the stack can be problematical.