Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 211975
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T18:08:37+00:00 2026-05-11T18:08:37+00:00

I faced one issue while working on a C code with Microsoft Visual Studio-2005

  • 0

I faced one issue while working on a C code with Microsoft Visual Studio-2005 compiler.

I tried to declare a big buffer statically as :

int gbl_data[4096*4096*256]; 

EDIT: This declaration was a global variable in a header file.

It was giving an compilation error saying – “cannot allocate an array of constant size 0”.

Means somehow the size of 4096X4096X256 was getting too large than the MAX_INT_LIMIT size (2^31) and may be wrapping around and become –ve or so. But then it should have given error as “negative subscript”.

I tried casting the constants as 4096UL x 4096UL x 256UL , still same compilation error.

What is the cause of this error?

Is it because the physical memory size falling short to allocate this large size buffer or what?

What is the fix for it?

Thanks you.

-GM.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-11T18:08:37+00:00Added an answer on May 11, 2026 at 6:08 pm

    The array size is not an int, it’s an unsigned int. An unsigned int has a max value of 4294967295. You got one more, and so it wraps around to 0.

    Casting the constants as longs doesn’t change anything, because longs are also 32-bit integers on most platforms.

    You could try with long longs instead, but now we run into another little problem.

    You’re trying to allocate 4 billion integers. a 32-bit CPU has a memory space of 4 billion bytes. You’re trying to allocate 4 times the maximum theoretical amount of memory that can exist. (16GB)

    So back to the drawing board. Figure out why you were trying to do this, and what you can do instead.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 220k
  • Answers 220k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer I just finished creating something very similar for a system… May 12, 2026 at 11:54 pm
  • Editorial Team
    Editorial Team added an answer Custom theme functions allow you to render content in a… May 12, 2026 at 11:54 pm
  • Editorial Team
    Editorial Team added an answer Why would I ever use non-interpolated strings? When you don't… May 12, 2026 at 11:54 pm

Related Questions

Is it possible to create nested master pages in an ASP.NET Web Application projects
I am currently being offered a job for an IT development business (notice I
I have a Core Data model in which a Task entity includes an optional
Please give me your valuable suggestions regarding the WebAii, Watin and Selenuim. Actually i

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.