Building blocks of a computer program

All computer programs revolve around two important concepts

  1. Data
  2. Instructions

Every programming language provides you with all the features so that you can write logical instructions and work with different types of data. In this tutorial we will talk about the important building blocks that are used to construct a computer program.

Statements

Like in English you write a sentence in programming we write a statement. A statement is an instruction to the CPU to perform an action. Many statements come together to make a meaningful program.

Data types

When working with data you have to inform the CPU about the type of the data to perform action on. All programming languages provide you with many data types like integers, characters, decimals, strings etc in order to help you correctly choose the type of data to work with.

Variables

The job of variables is to hold data. You can think of variables as a location in the RAM which has been given a nick name so that the programmer can identify that location by its name. When creating variables the programmer has to specify the data type of that variable so that appropriate amount of space can be allocated for storing that type of data in the RAM. We will talk more about data types and variables in coming tutorials.

Keywords

All programming languages have a set of reserved words which are considered to be a part of the programming language itself with a special meaning assigned to each of these reserved words. These reserved words are called keywords and a programmer is not allowed to use the names of these keywords for naming variables or functions in the program.

Functions

As you write bigger and bigger programs you have to logically divide your code into functions. A function is a set of instructions taken together and given a name. When you want to execute these instructions you call them by their name and they get executed. Every computer program has at least one function called the main function. The main function is considered the entry point into the program. The CPU starts the execution of your program from the main function.

Conditions and loops

All programming languages give you the power of implement conditional and repetitive logic in your programs. Almost every program you write needs these features. Conditions and loops are considered as the main building blocks of any computer program.

All the concepts discussed in this tutorial in brief will help you in writing computer programs and can be found in all modern day programming languages.

Quick Links

E-Magazines

@

Total Followers
Study Group Created
Study Group Joined
Following Teacher
Following Organization
Blog Articles Added
Questions Asked
Questions Answered
Jobs Posted
Total Members in Group
Questions asked by members
Tasks added in this Group

Please wait..

Ok

Login to Open ESchool OR Create your account    Login   SignUp