C Programming For Beginners - Part 5

Written by:  • Edited by: J. F. Amprimoz
Updated Oct 1, 2008
• Related Guides: Windows

In this article, we show you how to acquire a C compiler for testing your programs. We also show you how to prepare your programs for compiling and executing.

How to acquire a C compiler

In this article, we explain what you need to do to acquire a C compiler and how to get your program ready for execution.

First, you need to acquire a C compiler. There are many C compilers available for free on the Internet. Our favourite is the Tiny C compiler available at

http://bellard.org/tcc/

Go to the site, scroll to Download and click on the link tcc-0.9.24-win32-bin.zip next to “Windows binary distribution”. Save the file to your Desktop or any other convenient place of your choosing. Extract the files to a folder called TinyC, say, on your C: drive. You should see the following in the folder:

TinyCFiles01
click to enlarge
The compiler is in the file tcc.exe. Tiny C is a blazingly fast compiler. It is also very small. The complete compiler with support files is about one megabyte – it can fit on a diskette!

How to store your program

In C Programming For Beginners – Part 3, we met the following program which calculates the area of a square:

#include <stdio.h>
main() {int a, s;

 printf("Enter length of side: ");scanf("%d", &s); //store length in sa = s * s; //calculate area; store in aprintf("\nArea of square is %d\n", a); }

Next, you must type the program to a file: you can name the file AreaOfSquare.c. It is recommended that you use .c for any file that contains a C program.

You must store your program as a text file. You can use Notepad or WordPad. You can use Word (or another word-processor) but be sure to save it as a text file.

For convenience, we assume that you have created a folder C:\CPrograms and will store your programs there.

Summary: we assume the Tiny C compiler has been installed in

C:\TinyC

and your program is stored in a file AreaOfSquare.c in the folder C:\CPrograms.

In the next article, we show how to compile and run the program.


Comments

Showing all 2 comments
 
Lukas Nov 23, 2010 11:06 AM
Lukas >> Ba1tuks
Thank you very much! This is such an easy way start to learn a new computer language. I already good at "turbo pascal" or in other word FPS, but I am totaly green at C language :-)
charles cadogan Feb 18, 2010 1:58 AM
C programming for beginners
Simplistic and easy to follow!!!
 
blog comments powered by Disqus
Email to a friend