Author: Awais Farooq

  • C++ References

    A reference variable is an alias, that is, another name for an already existing variable. Once a reference is initialized with a variable, either the variable name or the reference name may be used to refer to the variable. References vs Pointers References are often confused with pointers but three major differences between references and…

  • C++ – Enumeration (Enum)

    In C++, an enumeration (or, enum) is a user-defined data type, where it consists of a set of named integral constants. Creating (Declaring) Enumeration Type To create an enumeration (enum), use the enum keyword followed by the name of the enumeration and a list of the named values further enclosed within curly braces. Syntax The following is…

  • C++ Pointers

    C++ pointers are easy and fun to learn. Some C++ tasks are performed more easily with pointers, and other C++ tasks, such as dynamic memory allocation, cannot be performed without them. As you know every variable is a memory location and every memory location has its address defined which can be accessed using ampersand (&)…

  • C++ Arrays

    C++ array stores a fixed-size sequential collection of elements of the same type. An array is used to store a collection of data, but it is often more useful to think of an array as a collection of variables of the same type. Instead of declaring individual variables, such as number0, number1, …, and number99, you declare…

  • Numbers in C++

    Normally, when we work with Numbers, we use primitive data types such as int, short, long, float and double, etc. The number data types, their possible values and number ranges have been explained while discussing C++ Data Types. Defining Numbers in C++ You have already defined numbers in various examples given in previous chapters. Here…

  • Foreach Loop in C++

    Foreach loop is also known as range-based for loop, it’s a way to iterate over elements through a container (like array, vector, list) in a simple and readable manner without performing any extra performance like initialization, increment/decrement, and loop termination or exit condition. Syntax The following is the syntax of for each loop − Here, How Foreach…

  • C++ Loop Types

    There may be a situation, when you need to execute a block of code several number of times. In general, statements are executed sequentially: The first statement in a function is executed first, followed by the second, and so on. Programming languages provide various control structures that allow for more complicated execution paths. A loop…

  • C++ decision making statements

    Decision making structures require that the programmer specify one or more conditions to be evaluated or tested by the program, along with a statement or statements to be executed if the condition is determined to be true, and optionally, other statements to be executed if the condition is determined to be false. Following is the…

  • Operators in C++

    An operator is a symbol that tells the compiler to perform specific mathematical or logical manipulations. C++ is rich in built-in operators and provide the following types of operators − This chapter will examine the arithmetic, relational, logical, bitwise, assignment and other operators one by one. Arithmetic Operators Arithmetic operators in C++ are the basic operators,…

  • Storage Classes in C++

    A storage class defines the scope (visibility) and life-time of variables and/or functions within a C++ Program. These specifiers precede the type that they modify. There are following storage classes, which can be used in a C++ Program The auto Storage Class The auto storage class is the default storage class for all local variables. Example Below…