Thank you for your response. The workaround that I figured was to set a constant high enough that it would be unlikely (yes I know....) that the user would ever use that variable. I then set my count variable to the size determined by user input. So I'm wasting memory, but it worked. I like your suggestion better as it seems more efficient. This program is for my final in an intro to c++ class. Thanks again!
Joshua
User Profile
Collapse
-
After looking at my question I noticed that I wasn't being clear enough. I want to define array size with the input integer. Sorry bout that.Leave a comment:
-
variable array size (constant problem)
I have a program that asks a user for a integer. This integer is a member of a struct statement. Later on in the program a function points to this structure in hopes of using the integer as a variable in an array. The problem that I'm seeing is that the complier, and likely the c++ coding standard, is looking for a constant to be decalared at compile. Am I thinking in the wrong way? I want to make an array that depends on the size of the input....
No activity results to display
Show More
Leave a comment: