Tag: Variables
C++11 Multithreading – Part 7: Condition Variables Explained
In this article we will discuss the usage of Condition Variable in C++11 Multi-threading with example. Condition Variables Condition Variable is a kind of Event used for signaling between two or more threads. One or more thread can wait on it to get signaled, while an another thread can signal this. Advertisements Header file required for condition …
C++11 Multithreading – Part 7: Condition Variables ExplainedRead More
For loop with 2 variables in C++ and Java
In this article we will discuss how to use for loop with two variables. For loop is basic feature we use in programming. In it we use a variable and keep on increasing or decreasing it till a condition is matched. Advertisements But many times a scenario comes where we want to increment or decrement two variables …
Using std::initializer_list in constructors to initialize member variables
In this article we will discuss how to use std::initializer_list<T> to initialize member variables. Suppose we have a class Point that has 3 member variables representing x, y & Z axis coordinates. It has a parameterized constructor too i.e. Advertisements class Point { int mX; int mY; int mZ; public: Point(int a, int b, int …
Using std::initializer_list in constructors to initialize member variablesRead More
C++11 Lambda : How to capture local variables inside Lambda ?
In this article we will discuss how to capture local variables from outer scope in Lambda. A simple Lambda syntax is, Advertisements [Captured variables](paameters) { function code } Local variables from outer scope can be captured inside Lambda in 2 modes i.e. By Value By Reference Capturing Local Variables by value inside Lambda Function To …
C++11 Lambda : How to capture local variables inside Lambda ?Read More
C++11 Lambda : How to capture member variables inside Lambda function
In this article we will discuss how to capture member variables from outer scope. Suppose we have a class OddCounter to keep the track of odd numbers read by the object. Inside its member function we are creating a lambda function and passing to a STL algorithm std::for_each. Advertisements Now this lambda function needs to capture …
C++11 Lambda : How to capture member variables inside Lambda functionRead More
Python : How to use global variables in a function ?
In this article we will discuss difference between local & global variable and will also see ways to access / modify both same name global & local variable inside a function.
Python – Variables
In this article, we will learn all that you need to know about the variables in python. In python, a variable is similar to a tag or reference that points to an object in the memory. For example, x = 1 Here ‘1’ represents an integer object in the memory, and x is a reference …
For Loop with two variables in Python
In this Python tutorial, you will learn to use for loop with two variables. Table Of Contents Introduction Using for loop with two variables to iterate over dictionary. Using for loop with two variables with zip(). Using for loop with two variables with enumerate(). Summary Introduction In python, for loop is used to iterate elements …
How to Set, List and Remove Environment Variables in Linux
Environment variables are key-value pair in Linux which are stored permanently or temporarily to be used by applications through shell. In this guide you are going to learn how to setup environment variables in Linux, list them and remove them. The global environment variables are stored in etc/environment. Any changes that is made in this …
How to Set, List and Remove Environment Variables in LinuxRead More