Thread: Miximum matrix size? / reading big arrays of data

  1. #16
    pwning noobs Zlatko's Avatar
    Join Date
    Jun 2009
    Location
    The Great White North
    Posts
    132
    Elya, in C you can use
    #define N_molPOL 356
    or try declaring them as const int.
    In C++ using a const int in an array decalration would work. I'm not sure about C.

    The general convention for defines is that they are all capitals, like this:
    #define N_MOLPOL 356
    but that's just convention.

  2. #17
    and the Hat of Guessing tabstop's Avatar
    Join Date
    Nov 2007
    Posts
    14,336
    Quote Originally Posted by Elya View Post
    Dear All,

    Thanks a lot for your advises. I made matrix static.
    insert
    Code:
    static double POLRx[N_molPOL][N_beadPOL][N_files];
    ......
    but I have got an error message.

    insert
    Code:
    mean_square_forum.c:10: error: variably modified ‘CRx’ at file scope
    mean_square_forum.c:11: error: variably modified ‘CRy’ at file scope
    .........................
    Is this actually allowed by C? I've read that such matrix declaration is permitted only in C++. Is this true?

    Thanks
    Elya
    No. You can't have such matrix declarations at all in C++. (They're probably referring to vectors instead.) If you do have a VLA, it must be inside a function. At a first glance, I don't see why you can't declare this in your main.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 48
    Last Post: 09-26-2008, 03:45 AM
  2. Bitmasking Problem
    By mike_g in forum C++ Programming
    Replies: 13
    Last Post: 11-08-2007, 12:24 AM
  3. Weird errors.
    By Desolation in forum C++ Programming
    Replies: 20
    Last Post: 05-09-2007, 01:10 PM
  4. Trouble with DMA Segmentation Faults
    By firestorm717 in forum C Programming
    Replies: 2
    Last Post: 05-07-2006, 09:20 PM