Tag Archives: C++

Call By Value Function Calls in C++

In Functions, by default, C++ lets you pass variables by value (Call by Value). This is to make sure it is more difficult to inadvertently create bugs in the code. These bugs would come easy if the default was a “Call by Reference” instead (read more on Call by Reference).

Let’s explore this further; “Call by Value” does not change the variable you pass to a function, even if that value is indeed changed by the function. So the default setup for parameter passing to functions makes it hard for you, the programmer, to unknowingly let the function change the variable that was passed.

Continue reading Call By Value Function Calls in C++

Call C++ Functions by Reference or Pointers

This tutorial is on C++ Call By Reference. In C++ programming, parameters of a function can be called in two ways, by value or by reference. Read more on Call by Value.

When the function is called by value, a copy of the parameters passed through a function call is created and that copy is used as the argument of the function. The actual value of the parameters is not changed if the corresponding arguments are modified inside the function body.

Continue reading Call C++ Functions by Reference or Pointers

Functions in C++

Welcome to the 8th Tutorial on C++ Tutorials for beginners series. This is this is first tutorial on c++ functions, a very important aspect of any programming language. Functions are often called methods as well in some programming languages, but in this tutorial we will restrict ourselves to the word function.

In this tutorial we will jump into the very basics of functions. We will describe what basically a function is, what its uses are and then will give few examples of how a function can be used in C++.

In the end we will see how a function can be passed argument and will explain this argument passing with the help of passing an array and string to this function with the help of pointers. So stay with us, you are going to learn something really awesome which will make your code a lot easier and fascinating.

Continue reading Functions in C++

POINTERS in C++

Introduction:

Welcome to the 7th tutorial in the series of Short Tutorial on C++ for beginners. We have discussed arrays and strings in the previous tutorial. Now is the time to discuss something more advanced and technical. Yes, we are going to discuss pointers in this tutorial. Pointers are considered one of the trickiest concepts in the C++ programming. But don’t worry; we are going to explain it in a very lucid manner. I can assure that after completing this tutorial, you will be teaching pointers to your fellows around.

Continue reading POINTERS in C++

Arrays & Strings in C/C++

Introduction:

Here we are with the 6th tutorial of the short series of tutorials for the beginners in C++. In this tutorial we are going to introduce you with the most fundamental data structure i-e: Numbered Array in C++.

We will discuss the most basic arrays along with its syntax and functionalities. Later on we will move into more complex arrays such as two dimensional arrays.

In the second part of this tutorial we are going to have some fun with strings in C++. We will discuss its usage and will define several string manipulation functions which can be applied on strings to get the desired results. So let the fun begin!

Continue reading Arrays & Strings in C/C++

C++ Switch Statement and Loops

Introduction:

Welcome to the 5th tutorial of this short tutorial series for beginners in C++. We are going to have some more fun with the control structures in this part. We will introduce you to the “Switch” statement and in the later part will move to the iteration structures such as “for”, “while”, “do while” loops. We will also explain some important statements which can be used inside a loop to control the iterations. These statements include “continue” and “break”.

Continue reading C++ Switch Statement and Loops

C++ Part 4 – else if / else / if nesting

We go into detail on the “if” statement. This includes the statements else, else if, and nesting if-else statements. After these concepts are covered, we will start a new programming Project: Metric Converter. You will see how advanced if-else statements, along with floating point math and Logical Operators will be used in this program.

Continue reading C++ Part 4 – else if / else / if nesting

Learning the Basics of C++ Programming

In this programming tutorial, you will start learning C++ programming basics. Starting with simple rules like the Semicolon, and how to use C++ Comments.

We will cover some basics like using Variables with Arithmetic Operators and Data Types, as well as cin and cout. We will take a look at how to use Parenthesis’s in simple math formulas, and using short hand (Compound Assignment) arithmetic statements.

Then you will program a simple C++ Console application (text input / output) using cin & cout, from what you have learned above. You will also learn the two kinds of errors (bugs) that stop programs from running: Syntax errors and Compiler errors.

Continue reading Learning the Basics of C++ Programming