I have a global multidimensional array, g_iAllData[MAX_LEN][MAX_WIDTH]
being used in a Form. When I write to it in a function: g_iAllData[iRow][iColumn]= iByte_Count;
I can see in a Watch Window that it's contents are not being changed. If I put the array in the function, it works fine.
Is there something I'm missing? I am declaring it as global after my #include
's at the top of the Form1.h file. I have multiple functions that are called by buttons being pressed and I need to write and read from the array in each function. It would be easier to keep it as global instead of passing it to each function.
UPDATE code:
ProgramName.cpp
#include "stdafx.h"
#include "Form1.h"
Form1.h
#include <iostream>
#include <string>
...
#pragma once
const int MAX_LEN = 4033;
const int MAX_WIDTH = 21;
int g_iAllData[MAX_LEN][MAX_WIDTH];
...
namespace ProgramName{
// later on
ReadFile();
void ReadFile(void)
g_iAllData[iRow][iColumn]= iByte_Count;