Relational operators are used to evaluate or test the relation between two expressions. There comes a time when we will need to connect two or more such evaluations or expressions and provide a compound output, like when we need to check whether a variable contains a number that is between 10 and 20. Logical operators are used in such cases where we have to combine the evaluation of the expressions.


This is known as the “logical AND” operator. It is used to check whether the condition on both sides of the operator is true.

int a, b;
bool condition1, condition2…

In programming, very often there arises a need to evaluate expressions. We may need to check whether the values stored in two variables are equal or whether the value in one variable is greater than the value in the other variable or vice versa and so on. We use relational operators for such operations.

Boolean Data Type

There is one special data type known as boolean. This data type can only store either of the two values: true or false. To use boolean data type in C, we have to import a header file known as ‘stdbool.h’.

Like we said variables are like boxes that are used to store values. We also saw how can we display the stored values. But we may also need to perform operations on those stored values. Operators help us to do this. Specifically, arithmetic operators help us to perform arithmetic operations on values.

In an operation, we will have an expression, operator and operands.


Here the whole statement is the expression, a and b are the operands and ‘+’ is the operator. …

We have done a simple hello world program and learned the concept of variables and data types in the previous articles. When we write larger programs, we think of an algorithm for the program before writing the code. We just don’t code right away. It’s always better to think about the algorithm or how we are going to implement the code before the actual coding. But, what is an algorithm and why is that important?


In our factory analogy compilers are analogous to engineers, a program is analogous to a plan and a programmer is analogous to a planner or…

Let’s imagine that a worker in a factory is assembling a product. For assembling, he needs screws. He takes some screws and puts them in a box near him. He takes the screws when he needed them. He is actually storing the screws in a place and uses them when he needs them. This is the concept of variables.


In programming, a variable is a place where we can store values. Here variable resembles the box and the value resembles the screw. So using variables we can store them and use them later when we need them.

Data Types

Even if the…

‘Hello World’ program is the most basic and introductory programs in every programming languages. Let’s see how we could write it and then explain it with the factory analogy. Before running the program make the setup needed to run the program in case you don’t have anything installed. We will be using C program to explain the concepts. You could install the C compiler or IDE(Integrated development environment), which is a software that is intended to making your coding easier and fun with lots of tools and features. Just a google search on “install C compiler and IDE to run…

This is an attempt to explain the basic concepts of programming with the analogy of a factory. Out of the many analogies I searched it was found to be the most convenient. Studying coding with the help of analogy will make it more easy to understand, less confusing, less boring and also helps to approach coding in the same way we interact with the world. For those who knows how to code already, it would be interesting to see it from another perspective.

This article explains what is a software, computer program, hardware and microcode using the factory analogy. …

“Any sufficiently advanced technology is indistinguishable from magic”. — Arthur C. Clarke(Science fiction writer)

We program machines. Our programs and machine hardware become more advanced, then again more advanced and again more advanced. From two bits: 0 and 1 and transistors, the digital world grown from mere digital calculators to machine learning and artificial intelligence. More and more objects from the physical world are being cloned to the digital world.

The algorithms become so intelligent and so the machines that contain them. The intelligent machines start to create new improved machines. This creates a cycle where the intelligent machines create…

The notification bell rings. You get the urge to check it. You took your phone and checked it. “Wow…One more like for my pic” or no bell and “Why my pic don’t get likes?”.

Just after watching a YouTube video, you are shown another video with similar interest. You feel the urge to watch it.

Completed a difficult level in a video game. You got a sense of achievement. You feel like a winner. You want to achieve more and so play more. But you failed, so you tried even harder for more hours.

Scenarios like these are common nowadays…

Biologically, the cause of addiction is dopamine and the reward system which is hijacked by addictive activities, making the brain believe the activities are good for the individual. But not all people show addictive behaviors. Some may do addictive activities yet they may not reach the point of addiction and at the same time some others do. Rat Park was a series of studies conducted to answer the cause of addictive behaviors.

Rat Park

Bruce K. Alexander and his colleagues at Simon Fraser University in British Columbia, Canada, set up two environments for rats¹. …

Shafi Sahal

Developer, adventure lover and a truth seeker

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store