Thread: Problem with simple arrays opperation

  1. #1
    Registered User
    Join Date
    Nov 2013
    Posts
    4

    Problem with simple arrays opperation

    Code:
    #include <stdio.h>
    #include <math.h>
    int main(void) {
       const int SIZE = 100000;
       double A[SIZE];
       double B[SIZE];
       double C[SIZE];
       int i;
       for (i = 0; i < SIZE; i++) {
          A[i] = B[i] = (double) i;
          C[i] = A[i] + B[i];
       }
       return 0;
    }
    I am using CodeBlocks IDE. After compilling and running, program crash. Process terminated with status -1073741510. Could some explain where the problem is?

  2. #2
    Registered User camel-man's Avatar
    Join Date
    Jan 2011
    Location
    Under the moon
    Posts
    693
    Exhausting stack space!. You can either make your arrays global, or you can use malloc to dynamically allocate their memory on the heap.

  3. #3
    11DE784A SirPrattlepod's Avatar
    Join Date
    Aug 2013
    Posts
    485
    Quote Originally Posted by camel-man View Post
    Exhausting stack space!. You can either make your arrays global, or you can use malloc to dynamically allocate their memory on the heap.
    Or make them static

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. simple question in arrays
    By abood1190 in forum C Programming
    Replies: 9
    Last Post: 05-13-2013, 12:59 AM
  2. C++:Simple program using 2d arrays?
    By rvbplayer123 in forum C++ Programming
    Replies: 6
    Last Post: 11-21-2012, 03:25 PM
  3. trouble with simple arrays
    By time4f5 in forum C Programming
    Replies: 10
    Last Post: 07-11-2011, 07:09 AM
  4. Simple arrays
    By DerrickakaDRoC in forum C Programming
    Replies: 12
    Last Post: 12-12-2010, 10:57 PM
  5. arrays - simple problem
    By ademkiv in forum C Programming
    Replies: 2
    Last Post: 03-02-2006, 09:55 PM