Posts

Nested Loops in C Programming Language

Image
  Nested Loops in C Programming Language In the previous blog posts we have studied about the loops, and different types of loops in C programming language. We know that loops are used to iterate or repeat a piece of code as per the requirement of our programming logic. And one of the main advantages of using these looping statements is that it increases code reusability and also enhances the performance of the program or code. Tody we are going to cover the nested loops in C programming language. We are going to look at that how can we nest a loop inside another loop. Now just keep one thing in mind that we can nest any loop inside any other looping statement . In other words we can say that we can place one loop statement inside the body of another loop statement. Now there is another very important point which is, when we use nested loops the inner loop completes all of its iterations for every single iteration of the outer loop . If outer loop runs M times and inner loop wil...

for loop in C programming language for beginners

Image
  for loop in C programming language for beginners Today in this blog post we are going to cover the for loop which is an entry controlled flow statement. These looping statements are used to iterate or repeat the piece of code several times according to the requirement of our C programming logic. It is preferred to use the for loop if we already know that how many times we want specific code to be executed. But if there is a scenario where it is not clear that how many times this loop should run then we use do loop or do while loop in C programming language. The for loop uses a variable which decides that how many times a specific piece of code should be iterated or repeated. The main advantage of these looping statements is that it reuses the code, and also enhances the speed and performance  of the code. In programming languages, we have control statements that are used to control the behavior of the programs as per user requirements. One of these control statements is for ...

while loop in C programming language

Image
  while loop in the C programming language In computer programming languages the concept of loops are one of the most core components that the programmers and developers use in order to iterate or repeat some piece of code. It will not only increase the reusability of code but also enhances the performance of our code. The looping statement that we will cover today in this blog post is while loop in C programming language. The while loop is also referred to as entry controlled loop that repeats and and executes a piece of code as long as the specified condition is true. We use while loop when we are not sure that how many times a specific piece of code should be iterated. Now before going deep into while loop in C programming language let us look at the basic syntax and working of while loop in C program. In computer programming languages there is a concept of control flow statements. In control flow statements we specify some conditions, and based on those conditions whether th...

How do-while loop works in C programming language?

Image
  How do-while loop works in C programming language? Loops are an essential part of any programming language. These looping statements are basically control structures that helps the users to execute the block of code. The looping statement that we are going to look at today is do while loop in C programming language.There is a key characteristic of do while loop is that, when we use the do while loop in our C programming or any other programming it will run atleast once no matter if the specific condition is true or false. In both the cases it will atleast once, without even checking the condition. We use control statements in programming languages to execute code based on certain conditions. In C programming the concept of control statement is the same. These control statements iterate pieces of code multiple times according to user requirements. These iterations are controlled by some conditions that are given by the programmer or the developer. There are mainly three types of...

Switch statement in c programming language

Image
  Switch statement in C programming language In todays blog post we will look at the use of control statements in C Programming language. These control statements basically execute one block of code from multiple options or conditions depending on the value of single expression. And the control statement that we are going to discuss today is switch statement . And it can be used as an alternate to if else if ladder statement . It is not just an alternate to the if else if ladder but it is considered as more clean, readable, and more efficient alternate as compared to if else if ladder statement . The switch statement is a conditional statement that we use to run different code sections based on some conditions. The switch statement also works like the if else-if else ladder statement. As we know in the else-if ladder statement we implement multiple conditions, it is exactly how the switch statement works. In the switch statement, we used the term case: that tells us about any sp...

How if else-if else ladder statement works in C program.

Image
 How if else-if else ladder statement works in C program. In this blog post we will cover the concept of conditional statements which also referred to as control structure statements . We have already discussed about the if statement in C programming language. But in this blog post we will cover the concept of if else if ladder statement in C program.  Before diving deep into this concept let us look at the basic syntax and basic working of if else if ladder statement. By now we know that decision making statements are very essential part part of any programming language so it is better to understand this concept first. The standard if condition simply checks the condition and if that condition is true it will simply execute the piece of code written with in its curly brackets. And if we talk about if else-if ladder statement in C programming language, when the if block condition becomes false it will terminate the if part and directly jumps to else part and execute ...

if and if-else statement in C programming language

Image
  If and if-else statement in C programming language In todays blog post we will cover the concept of conditional statements in C programming with simple examples, so that our audience can understand it in an easy manner. These conditional or control statements are used to control the flow of execution, based on some predifined conditions. Conditional statements are one of the basic builiding blocks of any programming language and the same is true with respect to C programming language. Today we will cover two of the most basic decision making statements or control statements which are known as, 1) if statement 2) if-else statement Before diving deep into C programming coding examples, let us look at the basic syntax and basic working of the two conditional statements. Basic syntax of if statement in C programming language if (condition) { // code to be written here. } If we look at the above if statement coding syntax we can see that, we started with the i...