Posts

Showing posts with the label functions in programming examples

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

Image
  How To Write a Hello World Program In C++ Programming Language In this post we will look at how a C++ program works. We will try make the example as simple as possible for the beginners so they can easily understand the basics of C++. We will write a simple C++ hello world program in C++ programming language which is considered as the very first program in almost every programming language. A Brief Introduction to the C++ Programming Language C++ is an object oriented programming language and it is an extension to C programming language. C++ is a general purpose programming language and it is also a case-sensitive language. C++ is very powerful programming language it has features of both low level and high level programming languages, and that is why it is called mid level programming language. Hello World program in C++ programming language Above is an example of a simple Hello World program in C++ programming language. Now let us look at the code, and I will take you...

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 a C program...