can I define as follows:
for example , I define a two-dimensional arrayCode:char a[785][106];
the MAX1 and MAX2 is how size?Code:char a[MAX1][MAX2];
can I define as follows:
for example , I define a two-dimensional arrayCode:char a[785][106];
the MAX1 and MAX2 is how size?Code:char a[MAX1][MAX2];
You can do like this
Code:#define MAX1 785 #define MAX2 106 char a[MAX1][MAX2];
HOPE YOU UNDERSTAND.......
By associating with wise people you will become wise yourself
It's fine to celebrate success but it is more important to heed the lessons of failure
We've got to put a lot of money into changing behavior
PC specifications- 512MB RAM, Windows XP sp3, 2.79 GHz pentium D.
IDE- Microsoft Visual Studio 2008 Express Edition
That depends on your compiler and your hardware and operating system.
Why don't you do a little experiment and see. When the array is too big, your compiler should give you an error to let you know that.
Tell us what you can get. It will be large, but not *that* large!
The array will get stored in the stack, which is generally of 1-2MB, so depending on it, the memory occupied by the array should never overflow this much amount. So, you can't do what you are asking for, it'll result in stack overflow.
HOPE YOU UNDERSTAND.......
By associating with wise people you will become wise yourself
It's fine to celebrate success but it is more important to heed the lessons of failure
We've got to put a lot of money into changing behavior
PC specifications- 512MB RAM, Windows XP sp3, 2.79 GHz pentium D.
IDE- Microsoft Visual Studio 2008 Express Edition
Hell no! Your computer wont have one hundred billion bytes of memory. And if your MAX2 is 106 as well then that's over ten-trillion bytes, which is probably well over your hard disk and RAM combined.
Even an array that can only just fit in memory usually isn't practical. You don't pick array bounds at random anyway. You have to consider how big it actually needs to be, or whether an array is even the right thing to use anyway. A sparse multi-way trie could be an alternative.
My homepage
Advice: Take only as directed - If symptoms persist, please see your debugger
Linus Torvalds: "But it clearly is the only right way. The fact that everybody else does it some other way only means that they are wrong"
HOPE YOU UNDERSTAND.......
By associating with wise people you will become wise yourself
It's fine to celebrate success but it is more important to heed the lessons of failure
We've got to put a lot of money into changing behavior
PC specifications- 512MB RAM, Windows XP sp3, 2.79 GHz pentium D.
IDE- Microsoft Visual Studio 2008 Express Edition