Programming C 01(Programming in C in 7 days! By: Siamak Sarmady)


programming language is perhaps the most popular programming language. C was created in 1972 by Dennis Ritchie at the Bell Labs in USA as a part of UNIX operating system. C was also used to develop some parts of this operating system. From that time C programming language has been the defacto programming language when fast programs are needed or the software needs to interact with the hardware in some way.

Most of the operating systems like Linux, Windows™, and Mac™ are either developed in C language or use this language for most parts of the operating system and the tools coming with it.

This course is a quick course on C Programming language. In our first lesson we will first write our first C program. We will then learn about printing to screen, variables and functions. We assume that you are familiar with at least one of the popular operating systems.

For this course you can use the following compilers or Programming Environments.

  1. • Gcc and cc in Unix and Linux operating systems
  2. • Borland C or Turbo C in DOS operating system or in Command line environment of windows operating system
  3. • “Bloodshed Dev-Cppintegrated development environment (IDE) gives you a complete and
  4. compact programming environment. It comes with “MinGW” and “GCC” C Compilers and
  5. you should not need anything else for this course.

We use “Bloodshed Dev-Cpp” for this course and we suggest you also use it. “Bloodshed Dev-Cpp” is
free and it can be downloaded from the website http://www.bloodshed.net (currently under the URL
http://www.bloodshed.net/dev/devcpp.html).
Your first C program
Let’s write our first C program.
Example 1-1: example1-1.c

#include <stdio.h>
main()
{
printf(“Hello World!\n”);
system(“pause”); //this line is only needed under windows
}

First step for running this program is to make a text file containing above code. Be sure that the file is a pure text file. You must save the text file with c extension.
Then you must compile the source code. The result of compile step is an executable file that you can
run it.
If you are running your example on Unix/Linux type operating systems you can remove the line which
is commented to be necessary just under Windows.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s