How do i use malloc?
My program program crashes if i use it more than once.
This is a discussion on How do i use malloc? within the C++ Programming forums, part of the General Programming Boards category; How do i use malloc? My program program crashes if i use it more than once....
How do i use malloc?
My program program crashes if i use it more than once.
int a; don't make a program without it.
I can't find anything that tells me how to use it
int a; don't make a program without it.
PHP Code:char *str;
str = (char *)malloc(10); // str now points to a block of 10 bytes (error check this)
free(str); // Free the memory
str = NULL; // So we don't accidently cause a crash by accessing memory that we free'd
__ &n bsp; ___ & nbsp; &nb sp;   ;
/\ \ __ &nbs p; /\_ \   ; & nbsp;
\_\ \/\_\ ____ _ __\//\ \ __ __&n bsp; __
/'_` \/\ \/\_ ,`\ / __`\\ \ \ /\ \/\ \ /'__`\
/\ \_\ \ \ \/_/ /_/\ \_\ \\_\ \_\ \ \_/ |/\ __/
\ \___,_\ \_\/\____\ \____//\____\\ \___/ \ \____\
\/__,_ /\/_/\/____/\/___/ \/____/ \/__/ \/____/
&n bsp; I have a BAD figlet& nbsp;addiction.
ops i mean to say realloc
int a; don't make a program without it.