Re: Strange Error with Arrays


[ Follow Ups ] [ Post Followup ] [ CS1044 Web Discussion Board ] [ FAQ ]

Posted by Chris on November 13, 2001 at 12:50:12:

In Reply to: Strange Error with Arrays posted by Zach Egolf on November 12, 2001 at 17:35:38:

: I'm been up and down the book, the discussion list, as well as other various resources and I have been unable to determine why I'm getting the following errors.

: error C2057: expected constant expression
: error C2466: cannot allocate an array of constant size 0
: error C2133: 'licensePtOne' : unknown size

: please don't tell me that I need to initialize my variables with constant integers, because I do that and it gives me the errors, but when I use "Magic Numbers" I don't get these errors. Has anyone else had these errors, or similar problems? Any help would be appreciated

I had the same problem when I was trying to create an array that was only large enough for the specific input file. The expression used to declare the array must either be a literal number(Magic Number) or a constant. I dont know how to do it with a variable.
My solution was to just declare arrays of a fixed size that would be large enough to handle any input file.
Hope this helps


Follow Ups:



Post a Followup

Name:
E-Mail:

Subject:

Comments:

Optional Link URL:
Link Title:
Optional Image URL:


[ Follow Ups ] [ Post Followup ] [ CS1044 Web Discussion Board ] [ FAQ ]