C++ Programming

How to use Smart Pointers in C++ with Example Code

by Santosh Yadav on February 12, 2015

In C and C++ programming, pointers are very powerful.

As we explained in C pointers example article, pointers are variables that hold address of another variable so that we can do various operations on that variable.

Sometimes a programmer can’t imagine writing a code without using pointers, whether it is a simple binary search tree program, or a complex enterprise application.

But, pointers are hard to manage, master, and they can cause many problems if not handled properly.

For example, when not properly used, it can cause core dumps, dangling pointer, null pointer exception, memory leaks, etc.
(more…)

When you start writing your code in C, C++ or any other programming language, your first objective might be to write a program that works.

After you accomplished that, the following are few things you should consider to enhance your program.

  1. Security of the program
  2. Memory consumption
  3. Speed of the program (Performance Improvement)

(more…)

To understand fuzzy logic, let us take a very simple example.

Imagine a simple light bulb which has two states: light on and light off.

We can mark the light off as false, and light on as true. This would be simple system that has two states and is described with George Boole’s logic. In his honor we have bool data type in C++.

Next, imagine that the simple light bulb could also be dimmed.
(more…)

If you are working on any object oriented programming languages (For example, C++), the following are some of the important concepts that you should understand during your learning phase.

Out of the following concepts, in this article, you’ll learn the basics of Inheritance and Abstract class using a sample C++ code snippet and an explanation that goes along with it.
(more…)

Converting data types from one to another is a most basic aspect for any programmers.

First, let us start with the basics.

int nNumber;

The following are few things to keep in mind for the above line of code:
(more…)

How to use C++ Namespaces with an Example Code

by Koscica Dusko on May 8, 2014

When we talk about namespaces, we should understand certain things about one important operator from the world of C++.

That one important C++ Operator is “::”

When you confront a C programmer with “::” operator, he might look at it but not understand it.

It is one of the things that distinguish the C++ world from C world.
(more…)

How to Debug Programs on Remote Server using GDBServer Example

by Lakshmanan Ganapathy on April 28, 2014

GDBRemote debugging is the process of debugging a program running on a different system (called target) from a different system (called host).

To start remote debugging, a debugger running on host machine connects to a program which is running on the target via network.

The debugger in the host can then control the execution of the program on the remote system and retrieve information about its state.
(more…)

Statistics is an essential part of Math, they have several practical applications, but sometimes very hard to understand for non mathematicians.

In this tutorial, we’ll focus on how to implement an algorithm to calculate statistical median.
(more…)