In my previous article I showed how to create a linked list. Now if you no longer need the linked list in your program, you have to delete that. Otherwise, it will lead to memory leak. Here we’ll see how to delete linked list completely. C Function to Delete Linked List This function takes the … Continue reading “C Program to Delete Linked List”
Static Members in C++ Template Class
We generally use static members in C++ class to maintain something that is not object specific, rather class specific. For example, if we want to maintain a counter about how many objects are created from a class, we keep a static counter in the class. In the class constructor, we increment the counter and we … Continue reading “Static Members in C++ Template Class”
How to find position of a digit in a number in C programming?
This program will find out the position of a digit in a number. If the digits exists in multiple positions, this program will find all positions. For example digit 4 is present in 41234253 at 4th and 8th positions from left. He is the Output: Logic is simple: in every iteration we do modulo operation … Continue reading “How to find position of a digit in a number in C programming?”
What is std::unique_ptr? How to Use std::unique_ptr?
std::unique_ptr is a smart pointer that owns and manages another object through pointer. std::unique_ptr has unique ownership of the object. That means only one std::unique_ptr can have the ownership of the actual object. We can not assign a std::unique_ptr object to another smart pointer. std::unique_ptr disposes the managed object when the unique_ptr goes out of … Continue reading “What is std::unique_ptr? How to Use std::unique_ptr?”
How to do Asynchronous Operations using boost::asio?
Boost::asio is primarily designed for accomplishing time-consuming networking I/O (Input/Output) operations in an asynchronous way. I/O operations over network usually takes considerable time to complete. In synchronous mode, if you call a function that does I/O operation over network, the calling thread blocks until the I/O operation is complete. This is not acceptable in many … Continue reading “How to do Asynchronous Operations using boost::asio?”