Running valgrind on your program produces the following outp
Running valgrind on your program produces the following output:
24 bytes in 1 blocks are definitely lost.
State a reason for this error (don’t worry about getting specific with the bytes-just give reasons).
Solution
Actually it is a process of memory loss concept. What happens is consider a pointer process that points to block/another value whose data is stored in computer memory using its memory address. What if the object that stores the data is themselves lost i.e. if the pointer is lost so in such a case not only a single block is lost but all the blocks that points to this pointer are lost.
It is a kind of memory leak that basically occurs due to loss of a block or a set of blocks. It is like a symptom if a pointer is lost that all the nodes pointing to it are lost.
For example: Consider a tree with a root node that master’s it and have say 5 children. In case if the root node is lost then all the links it has with its children is also lost. It means ultimately the tree has no value exist.
