malloc, realloc..wat on earth!

This is a discussion on malloc, realloc..wat on earth! within the C Programming forums, part of the General Programming Boards category; hey guys..i need some help on understanding how to use malloc and then realloc in my programme..the sizes of my ...

  1. #1
    Registered User
    Join Date
    Dec 2007
    Posts
    16

    Unhappy malloc, realloc..wat on earth!

    hey guys..i need some help on understanding how to use malloc and then realloc in my programme..the sizes of my arrays are always varying based on some parameters that i have in my program, so i know that i need to use the realloc function for the sizes of several arrays, but to do that i must first use malloc which i have no idea how to use!..so help pleasee..i need to use it for the sizes of these arrays, all of type float: t[i], x[i].
    i know it has something to do with declaring pointers, but i dnt no which pointers to declare!


    many thanxxxxxxxxxx

  2. #2
    The larch
    Join Date
    May 2006
    Posts
    3,573
    I might be wrong.

    Thank you, anon. You sure know how to recognize different types of trees from quite a long way away.
    Quoted more than 1000 times (I hope).

  3. #3
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,551
    There are some examples in the FAQ.
    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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  4. #4
    Registered User ssharish2005's Avatar
    Join Date
    Sep 2005
    Location
    Cambridge, UK
    Posts
    1,682
    here is one good tutorial for you http://randu.org/tutorials/c/dynamic.html

    ssharish

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. malloc and realloc
    By jayfriend in forum C Programming
    Replies: 4
    Last Post: 01-05-2007, 01:25 PM
  2. To malloc or not realloc on struct members
    By gh0st in forum C Programming
    Replies: 4
    Last Post: 11-17-2006, 04:27 AM
  3. malloc, realloc
    By figo2476 in forum C Programming
    Replies: 3
    Last Post: 04-28-2006, 10:11 PM
  4. malloc and realloc
    By odysseus.lost in forum C Programming
    Replies: 3
    Last Post: 05-27-2005, 08:44 AM
  5. Need help on malloc and realloc
    By YevGenius in forum C Programming
    Replies: 8
    Last Post: 03-06-2004, 12:55 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21