Miximum matrix size? / reading big arrays of data

This is a discussion on Miximum matrix size? / reading big arrays of data within the C Programming forums, part of the General Programming Boards category; Elya, in C you can use #define N_molPOL 356 or try declaring them as const int. In C++ using a ...

  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,185
    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.

Page 2 of 2 FirstFirst 12
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-07-2007, 11:24 PM
  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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21