473,403 Members | 2,183 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

I don't get the error with the following

code ================

const int Population = 50000;

typedef struct {
int IQ;
int Persistance;
int Account;
int AccStmt;
int Recruiter;
} pplstrk;

static pplstrk Person[Population];

============= endcode

gcc compile error:

pscam.c:25: error: variable-size type declared outside of any function
Is that not the way is supposed to be done? Did I learn a wrong way of
doing it?

Thanks.
Nov 14 '05 #1
4 1023
in comp.lang.c i read:
const int Population = 50000;
const qualified variables are not constants, merely read-only.
static pplstrk Person[Population];
thus this is a variable length array, which is only allowed within block
scope.
Is that not the way is supposed to be done? Did I learn a wrong way
of doing it?


you seem to have learned c++.

--
a signature
Nov 14 '05 #2
those who know me have no need of my name wrote:
in comp.lang.c i read:

const int Population = 50000;

const qualified variables are not constants, merely read-only.

static pplstrk Person[Population];

thus this is a variable length array, which is only allowed within block
scope.

Is that not the way is supposed to be done? Did I learn a wrong way
of doing it?

you seem to have learned c++.

LOL, :)

Yea, I got it fixed by making another #define

Seams, that not all compilers are created equil.

Thanks.
Nov 14 '05 #3
Kenneth Lantrip wrote:
code ================

const int Population = 50000;
Population is a variable. If you need a constant, as for an array size
in a declaration, #define it.

typedef struct {
int IQ;
int Persistance;
int Account;
int AccStmt;
int Recruiter;
} pplstrk;

static pplstrk Person[Population];

============= endcode

gcc compile error:

pscam.c:25: error: variable-size type declared outside of any function
Is that not the way is supposed to be done?
No.
Did I learn a wrong way of
doing it?


Yes.
Nov 14 '05 #4
On Sun, 18 Jul 2004 04:44:21 GMT, in comp.lang.c , Kenneth Lantrip
<nu***@bidny.ok> wrote:
those who know me have no need of my name wrote:
in comp.lang.c i read:
Is that not the way is supposed to be done? Did I learn a wrong way
of doing it?
you seem to have learned c++.


Yea, I got it fixed by making another #define

Seams, that not all compilers are created equil.


No! Read the previous poster's explanation again.

Your code was wrong - not the compiler.
--
Mark McIntyre
CLC FAQ <http://www.eskimo.com/~scs/C-faq/top.html>
CLC readme: <http://www.angelfire.com/ms3/bchambless0/welcome_to_clc.html>
----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
Nov 14 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Michael | last post by:
I have broken PythonWin and I don't know how or why. It worked great until recently. I have installed / removed several apps since it worked last. I could have a virus unknown to my antivirus...
10
by: Ricola ! | last post by:
Two c# dll's were compiled and added to the GAC. They appear in the .NET Configuration tool. However, when trying to add a reference to a new project, the dlls do not appear in the .NET...
1
by: Gary D. Rezek | last post by:
Hi All, I've got a set of asp pages used to register students into the ResNet database. Testing things out under different browser security settings I ran into a problem. The following buttons.......
2
by: Bobby Howell | last post by:
Hi. I have the following which I use either on my server using cscript (.vbs file) or identical code in my ASP pages. The problem is when running in ASP I recieve the following error:...
0
by: xixi | last post by:
we are using db2 udb v8.1 on win 64 bit with fp3 with type 4 db2jcc.jar driver. such error generated , please help me understand this , thanks 2004-01-12-14.09.02.400000 Instance:DB2 ...
6
by: Peter Frost | last post by:
Please help I don't know if this is possible but what I would really like to do is to use On Error Goto to capture the code that is being executed when an error occurs. Any help would be much...
7
by: wmkew | last post by:
Hello everyone I'm encountering a R6002 Runtime error and several bugs when trying to generate a simple Managed C++ application with .NET 2003. The main problem seems to arise from linking with...
2
by: Brandon | last post by:
I don't know if this is the right newsgroup for this question . . . if not, please let me know. I'm a newbie to asp.net (C#) and I'm trying to create a very simple page dependent on a master...
2
by: mike_li | last post by:
On Window 2000 Professional Server DB2 UDB Level: DB2 code release "SQL07029" with level identifie "030A0105" and informational tokens "DB2 v7.1.0.98", "n040510" and "WR21337". In the...
20
by: Tony | last post by:
I have a situation where I want to send data, but I have no need for a response. It seems to me that XMLHTTPRequest is the best way to send the data, but I don't need any response back from the...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.