C Board  

Go Back   C Board > General Programming Boards > C Programming

Reply
 
LinkBack Thread Tools Display Modes
Old 07-08-2009, 07:07 AM   #16
pwning noobs
 
Zlatko's Avatar
 
Join Date: Jun 2009
Location: The Great White North
Posts: 125
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.
__________________
Sun Certified Java Programmer / Developer
IEEE CSDP
Zlatko is offline   Reply With Quote
Old 07-08-2009, 07:43 AM   #17
and the Hat of Guessing
 
tabstop's Avatar
 
Join Date: Nov 2007
Posts: 8,740
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.
tabstop is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Abnormal Program Termination when executed from C:\Program Files\... m37h0d Windows Programming 48 09-26-2008 03:45 AM
Bitmasking Problem mike_g C++ Programming 13 11-08-2007 12:24 AM
Weird errors. Desolation C++ Programming 20 05-09-2007 01:10 PM
Trouble with DMA Segmentation Faults firestorm717 C Programming 2 05-07-2006 09:20 PM


All times are GMT -6. The time now is 08:38 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.0 RC2

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