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

  • SEARCH
  • Home
  • 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 8554215
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T14:49:49+00:00 2026-06-11T14:49:49+00:00

Possible Duplicate: C programming, why does this large array declaration produce a segmentation fault?

  • 0

Possible Duplicate:
C programming, why does this large array declaration produce a segmentation fault?

I have written a simple program.

#include <iostream>

using namespace std;

int main(int argc, char* argv[])
{
    int genotype[150000000];
}

But I get a strange error:

RUN FAILED (exit value 1, total time: 131ms)

How can I save this amount of int?

(I have enough memory to save this amount of ints and my computer is 64-bit)

  • 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-06-11T14:49:50+00:00Added an answer on June 11, 2026 at 2:49 pm

    Your stack is too small. Put this on the heap, using new:

    int* genotype = new int[150000000];
    

    And i hope that following will be useful.

    • signed char: -127 to 127 (note, not -128 to 127; this accommodates 1’s-complement platforms)
    • unsigned char: 0 to 255
    • “plain” char: -127 to 127 or 0 to 255 (depends on default char signedness)
    • signed short: -32767 to 32767
    • unsigned short: 0 to 65535
    • signed int: -32767 to 32767
    • unsigned int: 0 to 65535
    • signed long: -2147483647 to 2147483647
    • unsigned long: 0 to 4294967295
    • signed long long: -9223372036854775807 to 9223372036854775807
    • unsigned long long: 0 to 18446744073709551615

    Or you can use limit.h to find out around what your program relies on.
    For example, this is how you will find maximum range for int:

    C:

    #include <limits.h>
    const int min_int = INT_MIN;
    const int max_int = INT_MAX;
    

    C++

    #include <limits>
    const int min_int = std::numeric_limits<int>::min();
    const int max_int = std::numeric_limits<int>::max();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: C programming, why does this large array declaration produce a segmentation fault?
Possible Duplicate: C programming, why does this large array declaration produce a segmentation fault?
Possible Duplicate: Storing file content into an array I'm programming a simple hangman program.
Possible Duplicate: Sizeof an array in the C programming language? I have an array
Possible Duplicate: Sizeof an array in the C programming language? Why does a C-Array
Possible Duplicate: Reference - What does this symbol mean in PHP? I've been programming
Possible Duplicate: Sizeof an array in the C programming language? I'm trying to write
Possible Duplicate: Sizeof an array in the C programming language? Why is the size
Possible Duplicate: C programming : How does free know how much to free? When
Possible Duplicate: Why does gcc have “â” in all its error messages? New to

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.