Is it possible to declare an array with a variable as its index value, so that the user himself/herself can enter the exact number of items required....??
AzizTitu 0 Newbie Poster
Recommended Answers
Jump to PostYes, it is possible but it is not recommended.
Why?
It is better to have dynamically allocated array in this case.
Again, why? Please assume that the compiler supports C99, since the obvious "it's not portable" prior to C99 is obvious.
int *array = …
All 3 Replies
Moschops 683 Practically a Master Poster Featured Poster
rustysynate 0 Newbie Poster
deceptikon 1,790 Code Sniper Team Colleague Featured Poster
tux4life commented: Nice tip about sizeof ;) +13
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.