Answer Posted / achal ubbott
Here is an example of dangling pointer.
char* p = new char;// allocate a byte from heap section.
delete p ; // deallocation.
*p = 44 ; // using a dangling pointer.
| Is This Answer Correct ? | 8 Yes | 0 No |
Post New Answer View All Answers
What is polymorphism and its type in c++?
Do the names of parameters have to agree in the prototype, definition, and call to the function?
Why do we need templates?
What are c++ tokens?
Which bitwise operator is used to check whether a particular bit is on or off?
What's the best free c++ profiler for windows?
What is lvalue?
how can i access a direct (absolute, not the offset) memory
address?
here is what i tried:
wrote a program that ask's for an address from the user,
creates a FAR pointer to that adress and shows it. then the
user can increment/decrement the value in that address by
pressing p(inc+) and m(dec-).
NOW, i compiled that program and opened it twice (in 2
different windows) and gave twice the same address to it.
now look what happen - if i change the value in
one "window" of the program, it DOES NOT change in the
other! even if they point to the same address in the memory!
here is the code snippet:
//------------------------------------------------------
#include What is the two main roles of operating system? Write a code/algo to find the frequency of each element in an array? What are the implicit member functions of class? Explain the term memory alignment? What is the difference between C and CPP? What is function prototyping? What are its advantages? What is a c++ vector?