Welcome to my basic C programing tutorial. You can download Turbo C 3.0 using the links below.


Turbo C 3.0
HostFile
Doteasytc3.ziptc3.exe
Geocitiestc3.zip 

Let's start the tutorial with a simple program.

For this tutorial you should to have TC 3.0 running and a browser so that you can view the tutorial. You can switch between browser and TC 3.0 by pressing Alt-Tab.

#include <stdio.h>
#include <conio.h>

void main()
{
clrscr();
printf("Let's learn C programming.");
getch();
}

This litle progam outputs the the phrase "let's learn C programming" on the the screen.


Let's learn C programming.


Now let me tell you what each line means and does.

#include <stdio.h>
#include <conio.h>
These lines are called the preprocessors. Commands, like printf, are contained in these prepreprocessor not the compiler itself. Just remember you need the stdio.h, or standard input & output, to be able to use printf, scanf and such. Conio is needed for the clrscr or clear screen.

main()
This where the actual program begin and end. Void means that it does not return a value.

clrscr();
Clears the screen. Simple as that.

printf("Let's learn C programming.");
Prints whatever is inside the quotes inside the parenthesis. Another command similar to printf is scanf which allows for the user's input.

getch();
This allows you to time to read the ouput on the screen. Without it the program would just exit quickly and you wouldn't be able to see the output.

One thing you should notice are the semicolon(;) at the end of each statment except for main(). These semicolon indicate where the statement ends. A statement is one complete command just like printf("Let's learn C programming.");. A statement can have many statement within itself and is contained in within the curly brace ({}) just like main().

Try it out yourself, it's the only way you'll learn. Next we'll talk about variables, scanf and math operators.

>>Next>>