Posts

Showing posts with the label c structures for beginners

If Else If ladder statement in C++ Programming Language

Image
 If Else If ladder statement in C++ Programming Language In programming languages we have conditional statements or decision making statements that we can use in order to make decisions among multiple conditions. Today we are going to cover a simple conditional statement which is known as if-else-if ladder statement in C++ programming language.  In C++ programming language the if-esle-if ladder statement is a multi-way decision-making construct, it allows us to test different  conditions in sequence, and executing the block of code associated with the first condition that evaluates to be true. Syntax of if-else-if ladder statement in C++ programming language if(condition1) {     //code to be executed if condition1 is true     } else if(condition2) {     //code to be executed if condition2 is true     }     else if(condition3) {     //code t...

How to use Structures in C Programming Language

Image
  How to use Structures in C Programming Language In programming languages like C, C++, C#, etc., sometimes we encounter a situation where we need to store different variables with different datatypes, but these variables are related to one object or instance. In such situations, we use data structures. Today, we are going to discuss a simple technique that will help us store related variables in one place, namely, structures. We will look at how structures are used in the C programming language to help us achieve our target. What is Structure in C Programming Language We can consider structure as a special type of data structure that we can use to store data related to an entity under one umbrella and we can call it structure. We can consider a structure as a user-defined data type and it allows us to store various data types in one place. In structures, each data member used inside the structure body is called a member of a structure. How we can create a Structure...