In a function I placed the int array: factor[ g + 1] . g being input from the standard input but the program makes the array into this: factor[-1]. By the way I'm using xCode on mac. Why does this happen?
vincenzorm117 -4 Newbie Poster
Recommended Answers
Jump to PostCan you post your code? (or a representative snippet from it)
Jump to PostIt's because array indexes must be known at compile time (unless you are using malloc to create dynamic memory). Try putting it in as a constant value. I'm not sure what was giving you -1 but it's a good bet it is a compiler extension as that should have given …
All 8 Replies
jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster
vincenzorm117 -4 Newbie Poster
jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster
vincenzorm117 -4 Newbie Poster
jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster
vincenzorm117 -4 Newbie Poster
jonsca 1,059 Quantitative Phrenologist Team Colleague Featured Poster
vincenzorm117 -4 Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.