Exforsys
+ Reply to Thread
Results 1 to 3 of 3

How to get the Size

This is a discussion on How to get the Size within the C and C++ forums, part of the Programming Talk category; I am starting my try with memory allocation dynamically in C programming language. I have a doubt namely how to ...

  1. #1
    rachelle is offline Member Array
    Join Date
    Apr 2006
    Answers
    97

    Question How to get the Size

    I am starting my try with memory allocation dynamically in C programming language. I have a doubt namely how to find at run-time the size of a dynamic memory allocation and this is an array. Kindly suggest some alternatives for achieving the size.


  2. #2
    Mukhtar Ahmad is offline Junior Member Array
    Join Date
    May 2007
    Answers
    12
    memory allocation dynamically is done by
    malloc() and calloc() functions in C language

    provide any example how you want the memory allocation dynamically?

    ................


  3. #3
    Sandhya.Kishannag is offline Member Array
    Join Date
    Feb 2012
    Answers
    66
    Memory is dynamically allocated in c by using malloc(), calloc() and realloc().

    void * malloc(size_t size);
    The malloc() function takes size_t as its argument and returns a void pointer. Void pointer is used because it can allocate memory for any type.
    Just store the size in a variable the same way that we are're storing the pointer in a variable and a struct can be used to put them both together.


    •    Sponsored Ads



Latest Article

Network Security Risk Assessment and Measurement

Read More...