Comment on Tutorial - Using free() Function in C By Daniel Malcolm



Comment Added by : Neo

Comment Added at : 2012-04-04 16:21:35

Comment on Tutorial : Using free() Function in C By Daniel Malcolm
Can you tell me what will happen when I use a free function call to release the memory allocated to a memory block on ONE of the MULTIPLE pointers pointing to that memory block, eg

void *ptr1,*ptr2,*ptr3;
ptr1=ptr2=ptr3=malloc(1000);
free(ptr1);

in this case, what will happen if I try to access ptr2 and ptr3, and for that matter, ptr1, before I have assigned NULL to them, and after the above code?


View Tutorial



Subscribe to Tutorials

Related Tutorials

Program using concept of byte long short and int in java

Update contents of a file within a jar file

Tomcat and httpd configured in port 8080 and 80

Java File

Java String

Count number of vowels, consonants and digits in a String in Java

Reverse a number in Java

Student marks calculation program in Java

Handling Fractions in Java

Calculate gross salary in Java

Calculate average sale of the week in Java

Vector in Java - Sample Program

MultiLevel Inheritance sample in Java

Multiple Inheritance sample in Java

Java program using Method Overriding

Archived Comments

1. It work fine with message below 160 chars. How can
View Tutorial          By: Milind at 2011-12-15 06:20:33

2. Small modification.
System.out.println(&qu

View Tutorial          By: Rohit at 2012-02-07 16:22:52

3. the DomParserExample.java shows MAlformedURLExcept
View Tutorial          By: dipesh at 2011-12-09 09:53:46

4. Thanks for providing detailed information .
View Tutorial          By: CM Mankar at 2008-03-18 04:37:03

5. main is not needed for a simple program...

View Tutorial          By: manoj at 2012-05-29 17:46:08

6. hey good code woww. this code lot of help me much
View Tutorial          By: vaibhav malpani at 2015-03-25 05:48:50

7. THNX RAMLAK..
HEY RAMLAK I HAVE A LOT OF DO

View Tutorial          By: Vinod at 2009-01-02 22:04:40

8. very simple explanation......
easily unders

View Tutorial          By: saurabh at 2009-04-17 16:02:30

9. Thanks to you for providing such a wonderful infor
View Tutorial          By: Tara Patra at 2010-08-30 07:22:44

10. hello friends .. am looking for the java code that
View Tutorial          By: ahmed at 2008-09-18 21:48:21