Archive

Posts Tagged ‘program’

[C Tutorial 1] Introduction to Programming

June 30th, 2011 No comments

In these tutorials, we're not really getting into the whos & whens - our one and only aim is to write efficient programs in C. For everything else - there's Google.

Now, you could be here either to pass an exam - get a degree or you could be here for the love of code - to make something new. Make sure your's is the second reason. If not, make it so.

What is a Program? Why do we need to program at all?

Some people wonder(believe me, they do) - what's with this code stuff.. why do we really need to write a program at all? The answer is simple - even simpler if you know how a computer works. A computer or any electronic system for that matter, is made of a large number of switches or gates - When a certain combination of gates is created - an operation is performed. This combination is made by opening and closing appropriate switches.

Since a computer doesn't have a mind of its own - we need to give instructions to the computer in order to close and open the switches. This set of instructions is called a program. A program is essentially a blueprint for this combination.

What is a Compiler? Which compiler should be used for C?

Since our computer only understands binary - we need a "program" to translate the code written by us in a programming language of our choice - to binary. This program is called the compiler. The programs written by us are a "higher-level" (user-friendly or rather human-friendly) than what the computer understands.

You can download any of the C compilers available for free. Try Dev C++ (Download Link) or Code::Blocks (Download Link) to start with - and you can later switch to a compiler of your choice. A list of all the C compilers is available here.

[C++ Tutorial 1] The Basics

July 10th, 2010 No comments

Hello world! I just thought maybe a bunch of C++ tutorial could help. So here they are. To start with, a program is a simply, a set of instructions for the computer to do. The programmer is he who makes the instructions. And the language in which they are written is the programming language.

Low-Level VS High-Level Language

Now, just like you, your computer has its own languages-called the low-level languages(these are the ones your computer knows but they're hard for you to understand). Then there are the ones which resemble your language including words like if, else, while, for called the high-level languages(these are the ones you know but your computer does not).

THE COMPILER

Now, a compiler is just another program which makes your high-level languages understandable to your computer. It is a translator that translates the code written in a high-level language into assembly language(low-level). So, the first thing you need is the compiler. I use Dev C++. You can use whichever you like. (The most popular being Visual C++).

Programming PARADIGM

This is more theoretical and would not much really affect your coding skills, but anyhow-a paradigm is a style of programming. For instance, a procedural paradigm would concentrate on the sequence of the program, a generic paradigm would concentrate on generalization concepts like templates, etc. C++ is a multi-paradigm language.

[Go to Tutorial 2]