314 views
2 votes
2 votes
void main()
{
   int *ptr;
   .....
   .....
   {
       int ch;
       ptr = &ch;
   } 
   .....   
   // Here ptr is dangling pointer
}

Since here's no function calling and only main(). So, I am not able to understand which variable is going out of scope?

ptr or ch?

Thanks all!

1 Answer

Related questions

2 votes
2 votes
3 answers
2
Laahithyaa VS asked Sep 9, 2023
895 views
. What will be the value returned by the following function, when it is called with 11?recur (int num){if ((num / 2)! = 0 ) return (recur (num/2) *10+num%2);else return 1...
0 votes
0 votes
1 answer
3
Sahil Raza asked Oct 13, 2018
228 views
What is the differences between static and extern in C ? How it work ?
1 votes
1 votes
0 answers
4
Vishwanath Ravula asked Nov 23, 2016
145 views
What is difference between static scoping and dynamic scoping?