linux-c-programming.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Suciu Flavius <suciuflavius@tiscali.de>
To: linux-c-programming@vger.kernel.org
Cc: gcc-help@gcc.gnu.org
Subject: Re: Memory Allocation Problem
Date: Wed, 15 Sep 2004 08:35:41 -0700	[thread overview]
Message-ID: <ci8ne4$j4k$1@sea.gmane.org> (raw)
In-Reply-To: <20040915060237.55405.qmail@web52910.mail.yahoo.com>

1450 * 1450 * 8 = 16 MEGA!!!!!!!!!
So, you need a 16 mega of stack which I think is a little too much  ;)

The solution is to malloc() but check if you have 16 mega of ram ;)


Ankit Jain wrote:
>       1 #include <stdio.h>
>       2 int main()
>       3 {
>       4    double a[1450][1450];
>       5
>       6    a[1449][0] = 999;
>       7    printf( "%lf\n", a[1449][0] );
>       8    return 1;
>       9 }
> 
> 
> it gives segementation fault
> 
> if i use malloc also it gives wrong result
> 
> what to do?
> 
> ankit
> 
> ________________________________________________________________________
> Yahoo! Messenger - Communicate instantly..."Ping" 
> your friends today! Download Messenger Now 
> http://uk.messenger.yahoo.com/download/index.html
> 


  parent reply	other threads:[~2004-09-15 15:35 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-09-15  6:02 Memory Allocation Problem Ankit Jain
2004-09-15 12:01 ` Eljay Love-Jensen
2004-09-15 15:35 ` Suciu Flavius [this message]
2004-09-15  6:38   ` Chandan Chopra
     [not found] <4147E06B.4030303@redpinesignals.com>
2004-09-15  6:34 ` Ankit Jain

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='ci8ne4$j4k$1@sea.gmane.org' \
    --to=suciuflavius@tiscali.de \
    --cc=gcc-help@gcc.gnu.org \
    --cc=linux-c-programming@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).