Dangling Pointer in C


A pointer pointing to a memory location that has been deleted (or freed) is called dangling pointer. There are three different ways where Pointer acts as dangling pointer.

Source Code

//Dangling Pointer
#include<stdio.h>
#include<stdlib.h>
 
int * value()
{
    int a=10;
    return &a;
}
 
int main()
{
    int *ptr=NULL;
    ptr=value(); //&a
    printf("%d",*ptr);
    return 0;
}
 
 
 
To download raw file Click Here

List of Programs


Sample Programs


Switch Case in C


Conditional Operators in C


Goto Statement in C


While Loop Example Programs


Looping Statements in C

For Loop Example Programs


Array Examples in C

One Dimensional Array


Two Dimensional Array in C


String Example Programs in C


Functions Example Programs in C


Learn All in Tamil © Designed & Developed By Tutor Joes