Posts

if and if else statement in C++ programming language

Image
  If and if-else statements in C++ programming language In this blog post we will look at the basic working of if and if-else statement in C++ programming language. These if and if-else statements are also referred as conditinal statements in programming languages. But today we will study them under the context of C++ programming. In C++ programming language we use if and if-else to run a specific peace of code under one condition and another peace of code for some different condition. We also refer them as decision statements . Types of if statements in C++ programming language If we talk about types of if statements there are mainly four types 1) if statement 2) if-else statement 3) if else-if ladder statement 4) nested if statements But in this blog post we will cover the if and if-else statements. Syntax of if statement and basic working of if statement Syntax of if statement if (condition) { // code to be executed here. } Working of if sta...

How To Write Hello World Program In C++ Programming Language

Image
  How To Write a Hello World Program In C++ Programming Language Today in this blog post we are going to cover about the C++ programming language. C++ is a high level programming language, with the help of C++ programming we can build we can build different kind and types of applications. C++ is a high performance, general-purpose programming language, developed by Bjarne stroustrup at AT&T Bell labs in 1979. The C++ programming is basically an enhancement or extension of C programming language. There are some main features in C++ programming, which are, it is an object-oriented programming language, it uses exception handling, we are going to look at some more important features of C++ language in upcomming sections. For now keep this thing in mind that with the help of C++ programming language we can develop, 1) Desktop Applications. 2) Game Development. 3) Operating Systems. 4) Embedded Systems. 5) Device Drivers. 6) Client-Server Applications. 7) etc. I hope now you can und...

What is File Handling in the C Programming Language

Image
  What is File Handling in the C Programming Language Today in this blog post we are going to discuss about file handling in C programming language. And we are also going to cover that what are the uses of file handling and why do we need file handling in C programming language. Till now upto this point we have studied about various programs in C programming. So if we talk about basic use and need of file handling, it allows us to store data in a permanent secondary storage devices just like hard disk drives (HDD) in old systems and now in Solid State Drive (SSD) which is used in modern computers and is much more faster as compared to HDD. Some times we want the data produced by our program to be saved so that we can use that data later on, and there comes the need of file handling in C programming language. It enables us to create, read, update, and delete the files on the local file system.  In programming languages, we sometimes encounter situations where we need to store d...

How to use Structures in C Programming Language

Image
  How to use Structures in C Programming Language Today in this blog post we are going to cover a simple data structure which is known as structure (struct) in C programming language. Basically it is a user defined data type with the help of which we can group related variables of different data types together under a single name known as a structure . With the help of structures we can merge or combine different data types like integer, characters, double, float, arrays, etc. into a single record. 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. ...

Arrays in C Programming Language (One-Dimensional Array)

Image
  Arrays in C Programming Language (One-Dimensional Array) In today's blog post, we will explore one of the fundamental data structures known as arrays . Arrays play a vital role in a programming language, they allow us to use a single variable that can store multiple values of the same data type . And thus we don't need to make separate variables to store different values. Another important point to keep in mind is that in arrays the elements or values are stored in contiguous memory locations . And also the starting index of arrays is zero . Arrays are basically fixed sized collection of elements of same datatype. The elements or values are stored at contiguous memory locations. The main advantage or benefit of using arrays is that we dont need to make multiple variables for storing same type of data. We can simply use arrays instead, which is very easy and simple to understand and can be implemented in C programming language. Why ...

What is Call by Value and Call by Reference in C Programming

Image
What is Call by Value and Call by Reference in C Programming In todays blog post we are going to cover a very important concept that is call by value and call by reference. In C programming language there are two primary ways to pass arguments to a function, the first one is call by value and the second one is call by reference. 1) Call by value 2) Call by reference Now we will have a brief look at how these two primary ways of function calling works in C programming language. In call by value method we simply pass the value that is contained by the variable and in call by reference we simply pass the memory address of variable instead of its value. Just remember one thing at this point, the function parameter must be declared as a pointer(*) so that it can hold the address of variable or argument passed during function call. We use functions in programming languages like C, C++, C#, etc. Today we will cover some important concepts about functions that are implemented in C program...

How to use functions in C programming Language

Image
  Functions in C Programming Language In programming languages, there is a concept of functions that we use to implement some functionality in our code. Functions help us reuse the code and enhance its performance, as they are written once and tested again and again.  In C  programming we can use functions to break the code into smaller pieces that are easily maintainable. A function is a piece of code that is enclosed in curly brackets, and a function only runs and executes when it is called within a main program in C programming language. We can also pass data from our main program or function to any user-defined function . As we already discussed, the main advantage or benefit of functions is reusability . In functions, we can define the code once, and after that, we can use the function code many times, which enhances the reusability of the code.  We can also refer to functions as procedures or sub-routines in some programming languages. Basically when we run...