473,398 Members | 2,165 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

How to make a C++ array which have size bigger than 32767

I found it is not work when I access myarray[32768]. Thx.
Jul 22 '05 #1
4 2008
Andi Tse wrote:
I found it is not work when I access myarray[32768]. Thx.

Show your code.

What is the array type?

There is a big difference in size of an array between
an array of char and an array of float or a large class.

Have you tried allocating using operator new?

Have you checked your compiler documents to see if there
is a limit to the quantity of elements in an array?

Have you checked your compiler documentation to see if
there is a size restriction for an array declared as
auto?
--
Thomas Matthews

C++ newsgroup welcome message:
http://www.slack.net/~shiva/welcome.txt
C++ Faq: http://www.parashift.com/c++-faq-lite
C Faq: http://www.eskimo.com/~scs/c-faq/top.html
alt.comp.lang.learn.c-c++ faq:
http://www.comeaucomputing.com/learn/faq/
Other sites:
http://www.josuttis.com -- C++ STL Library book

Jul 22 '05 #2

"Andi Tse" wrote:
I found it is not work when I access myarray[32768]. Thx.


Hi Andi, not a very informative post. Sounds to me like you're trying to
create a very large array on the stack, and that won't work because the
stack relatively very small.
Try dynamic allocation, i.e., using new. For example:
char* foo = new char[some_big_integer_constant];
Don't forget to deallocate with a corresponding call to delete [].
Or you could use one of the many containers provided by the STL.

/ WP
Jul 22 '05 #3
PKH

"Andi Tse" <to***********@hotmail.com> wrote in message
news:bf**************************@posting.google.c om...
I found it is not work when I access myarray[32768]. Thx.


Maybe you are using 16 bits int's to access it ? If you switch to unsigned
int's you can access up to 65535, or switch to 32-bits unsigned integers
(dword) where the limit is 2^32 - 1 which is > 4.2 billion.
Just guessing .

PKH


Jul 22 '05 #4
....or maybe you are using Borland C++ 3.1? If so you should really switch to
something better.

VH

"Andi Tse" <to***********@hotmail.com> wrote in message
news:bf**************************@posting.google.c om...
I found it is not work when I access myarray[32768]. Thx.

Jul 22 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: mike | last post by:
hi, i am running a very big code on my pc using redhat linux. when i try to increase my array size, compile and run, i get segmentation fault. i go into the debugger, run it, it crashes right...
37
by: Carol Depore | last post by:
How do I determine the maximum array size? For example, int a works, but a does not (run time error). Thank you.
19
by: Tom Jastrzebski | last post by:
Hello, I was just testing VB.Net on Framework.Net 2.0 performance when I run into the this problem. This trivial code attached below executed hundreds, if not thousand times faster in VB 6.0...
9
by: ssubbarayan | last post by:
Hi all, I am trying a program to convert floating point values to a byte array and printing the same to the screen.The idea behind this is we already have an existing function which can do byte...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.