This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to create array dynamically in c++ ?

 
naved momin
Ranch Hand
Posts: 692
Eclipse IDE Java Linux
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i am doing a simple stuff

code in main


i just want to create an array dynamically after taking the value from user, how to do that , in simple manner , i am using turboC, because i am doing some computer graphics & my colg told me to use TurboC
can any one help me solve my problem ?
thanks
 
Jason Reaves
Greenhorn
Posts: 3
C++ Linux Monad
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Std C++ wants the array size to be a constant so it's known at compile time. If you need dynamic memory you can do something like.

Alternatively you can look into vectors which allow you to use it as a dynamic array.
c++ reference <vector>
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic