Thread: Dynamic Array - Size

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Nov 2009
    Posts
    11

    Dynamic Array - Size

    Hi Folks

    How to find the size of dynamic Array.....
    Can sizeof be used or .. .

  2. #2
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,413
    Keep track of the size yourself.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,667
    You keep hold of the variable you used to call malloc with in the first place.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. size of dynamic array
    By dayalsoap in forum C Programming
    Replies: 3
    Last Post: 10-05-2010, 08:54 PM
  2. How to get the size of an dynamic array?
    By sept in forum C++ Programming
    Replies: 7
    Last Post: 09-18-2007, 02:26 PM
  3. Dynamic Array Size?
    By Junior89 in forum C++ Programming
    Replies: 4
    Last Post: 04-04-2007, 11:31 PM
  4. size of dynamic array
    By tommy_gunn in forum C Programming
    Replies: 3
    Last Post: 12-30-2004, 08:01 PM
  5. Dynamic Array Size
    By minignaz in forum C Programming
    Replies: 11
    Last Post: 12-12-2003, 06:05 PM