Thread: Malloc function and program crash

  1. #16
    C++まいる!Cをこわせ!
    Join Date
    Oct 2007
    Location
    Inside my computer
    Posts
    24,654
    Quote Originally Posted by totalnewbie View Post
    4. I've been checking examples which at first use malloc and then realloc. That's why I used to think that it's not possible to use malloc and realloc separately.
    Usually, you use first malloc then realloc, but it is not a requirement, since realloc can work just like malloc.

    5. I usually program in Java, there's no problems with memory allocation or strings but in C they are entirely different. That's why I was so confused at first.
    And just a heads up - but there is C++, if what you do allows it. Similar to Java, but also an evolution of C.
    Quote Originally Posted by Adak View Post
    io.h certainly IS included in some modern compilers. It is no longer part of the standard for C, but it is nevertheless, included in the very latest Pelles C versions.
    Quote Originally Posted by Salem View Post
    You mean it's included as a crutch to help ancient programmers limp along without them having to relearn too much.

    Outside of your DOS world, your header file is meaningless.

  2. #17
    Registered User slingerland3g's Avatar
    Join Date
    Jan 2008
    Location
    Seattle
    Posts
    603
    "If ptr is a null pointer, realloc() behaves like malloc() for the specified size. "

    http://opengroup.org/onlinepubs/0079...h/realloc.html

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Undefined Reference Compiling Error
    By AlakaAlaki in forum C++ Programming
    Replies: 1
    Last Post: 06-27-2008, 11:45 AM
  2. Dikumud
    By maxorator in forum C++ Programming
    Replies: 1
    Last Post: 10-01-2005, 06:39 AM
  3. Replies: 3
    Last Post: 03-04-2005, 02:46 PM
  4. Interface Question
    By smog890 in forum C Programming
    Replies: 11
    Last Post: 06-03-2002, 05:06 PM
  5. qt help
    By Unregistered in forum Linux Programming
    Replies: 1
    Last Post: 04-20-2002, 09:51 AM